![]() |
TPopupMenu.OnClose?
Hallo zusammen
Ich vermisse beim PopupMenu das Ereignis, wenn es geschlossen wird - egal wie, auch durch Klick irgendwo ausserhalb. Wie bekomme ich das mit? Gruss Shaman |
Re: TPopupMenu.OnClose?
Schwupps
|
Re: TPopupMenu.OnClose?
Zitat:
die Form geschickt wird. Bei TPopupMenu's musst du das Fensterhandle von TPopupList subclassen. Das kannst du zum Beispiel so machen...
Delphi-Quellcode:
type
TForm1 = class(TForm) ... private { Private-Deklarationen } OldPopupListWndProc: TFNWndProc; NewPopupListWndProc: TFNWndProc; procedure PopupListWndProc(var Message: TMessage); ... end;
Delphi-Quellcode:
{--------------------------------------------------------------------------------------------------}
procedure TForm1.FormCreate(Sender: TObject); begin NewPopupListWndProc := MakeObjectInstance(PopupListWndProc); OldPopupListWndProc := TFNWndProc(GetWindowLong(PopupList.Window, GWL_WNDPROC)); SetWindowLong(PopupList.Window, GWL_WNDPROC, Longint(NewPopupListWndProc)); end; {--------------------------------------------------------------------------------------------------} procedure TForm1.FormDestroy(Sender: TObject); begin SetWindowLong(PopupList.Window, GWL_WNDPROC, Longint(OldPopupListWndProc)); end; {--------------------------------------------------------------------------------------------------} procedure TForm1.PopupListWndProc(var Message: TMessage); begin with Message do begin case Msg of WM_ENTERMENULOOP:; // PopupMenu wird geöffnet WM_EXITMENULOOP:; // PopupMenu wird geschlossen end; Result := DefWindowProc(PopupList.Window, Msg, WParam, LParam); end; end; {--------------------------------------------------------------------------------------------------} |
Re: TPopupMenu.OnClose?
Vielen Dank! :thumb:
Gruss Shaman |
Alle Zeitangaben in WEZ +1. Es ist jetzt 21:49 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz