Andries Bos wrote:
> I would like to execute some code as soon as a TPopupmenu disappears

Any arbitrary popup menu, or is this a popup menu that you have some 
control over?

If you have control over it, then make a descendant class, override the 
Popup method, and after you call the inherited method, invoke a new 
event handler.

type
   TPostPopupMenu = class(TPopupMenu)
   private
     FOnAfterPopup: TNotifyEvent;
   protected
     procedure DoAfterPopup; virtual;
   public
     procedure Popup(X, Y: Integer); override;
   published
     property OnAfterPopup: TNotifyEvent read FOnAfterPopup write 
FOnAfterPopup;
   end;

procedure TPostPopupMenu.DoAfterPopup;
begin
   if Assigned(OnAfterPopup) then
     OnAfterPopup(Self);
end;

procedure TPostPopupMenu.Popup(X, Y: Integer);
begin
   inherited;
   DoAfterPopup;
end;

-- 
Rob

Reply via email to