Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Deactivate event

Status
Not open for further replies.

Msilver2

Programmer
Apr 12, 2003
9
0
0
RO
I wrote a Delphi program. At the start, it put an icon on the task bar in the sys try zone, and autohide. If I move the mouse over the icon and press the right button, it displays a pop up menu.
This is OK. But now if I drag the mouse somewhere on the screen and I push the button, I can`t hide the pop up menu. I tried to use the Application.OnDeactivate event, but it doesn't work. How can I solve this problem ?
 
Is this in XP? I've noticed that XP tends to leave those menus open no matter what you do and you have to click on it to close it. Doesn't happen all the time, but occasioanlly it does. If this is something that happens everytime then I can't help you, don't use those myself.
 
Hello
Finally I find the solution. I had to put some additional lines in my program. Now it's 100% OK.
Thanks for: Tips_n_tricks, try icons - submitted by: Lennert Ploeger.

........
PopUpOpMenu.AutoPopup := false;

SetForegroundWindow(Application.Handle);
{ Win98 (unlike other Windows versions) empties a popup menu before
closing it. This is a problem when the menu is about to display
while it already is active (two click-events in succession). The
menu will flicker annoyingly. Calling ProcessMessages fixes this. }
Application.ProcessMessages;
// Now make the menu pop up
PopupOpMenu.PopupComponent := Form1;

PopUpOpMenu.PopUp(Mouse.CursorPos.X,Mouse.CursorPos.Y);
........
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top