Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Sonstige Fragen zu Delphi (https://www.delphipraxis.net/19-sonstige-fragen-zu-delphi/)
-   -   Delphi OnContextPopup Event funktioniert nicht (https://www.delphipraxis.net/122586-oncontextpopup-event-funktioniert-nicht.html)

thomas2009 18. Okt 2008 23:55


OnContextPopup Event funktioniert nicht
 
Hallo

konnte jemand mir sagen, warum bei mir die Event OnContextPopup in mein Code nicht funktioniert ?
OnClick funktioniert aber !
Delphi-Quellcode:
with TImage.Create(self) do begin
    OnClick := ShowMessage('Hallo');
    OnContextPopup := ShowMessage('blabla');
...

SimStar001 23. Okt 2008 18:14

Re: OnContextPopup Event funktioniert nicht
 
Ist das Event onContextPopup nicht nur für Popupmenüs und nicht für messagedlgs? :gruebel:

Uwe Raabe 23. Okt 2008 18:56

Re: OnContextPopup Event funktioniert nicht
 
Zitat:

Zitat von thomas2009
Hallo

konnte jemand mir sagen, warum bei mir die Event OnContextPopup in mein Code nicht funktioniert ?
OnClick funktioniert aber !
Delphi-Quellcode:
with TImage.Create(self) do begin
    OnClick := ShowMessage('Hallo');
    OnContextPopup := ShowMessage('blabla');
...

Ich bezweifle mal, daß diese beiden Zuweisungen funktionieren! Und folgerichtig sagt der Compiler auch:

[DCC Fehler] Unit25.pas(29): E2010 Inkompatible Typen: 'TNotifyEvent' und 'procedure, untyped pointer or untyped parameter'
[DCC Fehler] Unit25.pas(30): E2010 Inkompatible Typen: 'TContextPopupEvent' und 'procedure, untyped pointer or untyped parameter'

OnClick ist ein TNotifyEvent und so muss dieser Eigenschaft eine Objektmethode mit der passenden Signatur zugewiesen werden. Gleiches gilt sinngemäß auch für OnContextPopup.


Alle Zeitangaben in WEZ +1. Es ist jetzt 01:05 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz