TTrayIcon [Solved]


Re: TTrayIcon

Postby Antonio Linares » Sun Dec 06, 2009 9:07 pm

Finally fixed! :-)

This is the required change in Class TTrayIcon:
Code: Select all  Expand view  RUN

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
User avatar
Antonio Linares
Site Admin
 
Posts: 42122
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Previous

Return to Bugs report & fixes / Informe de errores y arreglos

Who is online

Users browsing this forum: No registered users and 14 guests