FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index Bugs report & fixes / Informe de errores y arreglos TTrayIcon [Solved]
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: TTrayIcon
Posted: Sun Dec 06, 2009 09:07 PM
Finally fixed! :-)

This is the required change in Class TTrayIcon:
Code (fw): Select all Collapse
METHOD Command( nWParam, nLParam ) CLASS TTrayIcon
      ...
      case nLParam == WM_RBUTTONDOWN .and. ! Empty( ::bRClicked )
           SetForegroundWindow( ::oWnd:hWnd )
           Eval( ::bRClicked, a[ 1 ], a[ 2 ] )
      ...

Now FWH\samples\TestTray.prg properly closes the Popup menu clicking outside it or pressing Esc :-)

This explanation from the msdn gave us the solution:

To display a context menu for a notification icon, the current window must be the foreground window before the application calls TrackPopupMenu or TrackPopupMenuEx. Otherwise, the menu will not disappear when the user clicks outside of the menu or the window that created the menu (if it is visible).

http://msdn.microsoft.com/en-us/library/ms648002(VS.85).aspx
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM

Continue the discussion