Little problem in TWindow

Little problem in TWindow

Postby Enrico Maria Giordano » Wed Feb 22, 2006 7:50 pm

In the following sample try to put the mouse pointer over the btnbmp and then press ALT. You will see that the menu is not activated as it does then the mouse pointer is not over the btnbmp.

Code: Select all  Expand view
FUNCTION MAIN()

    LOCAL oWnd, oMenu, oBar

    MENU oMenu
        MENUITEM "Test"

        MENU
            MENUITEM "Test1"
            MENUITEM "Test2"
            MENUITEM "Test3"
            MENUITEM "Test4"
        ENDMENU
    ENDMENU

    DEFINE WINDOW oWnd;
           MENU oMenu

    DEFINE BUTTONBAR oBar 3D OF oWnd

    DEFINE BUTTON OF oBar;
           TOOLTIP "This is a test";
           NOBORDER

    ACTIVATE WINDOW oWnd

    RETURN NIL


A possible fix (but I don't know if it is the best one):

Code: Select all  Expand view
METHOD SysCommand( nWParam, nLParam ) CLASS TWindow

   local bKeyAction

   if ::oBar != nil //EMG
      AEval( ::oBar:aControls, { | oCtl | If( oCtl:ClassName() == "TBTNBMP", oCtl:LostFocus(), ) } ) //EMG
   endif //EMG

   if nWParam == 61696 // VK_F10
      if ( bKeyAction := SetKey( VK_F10 ) ) != nil
         Eval( bKeyAction, ProcName( 4 ), ProcLine( 4 ), Self )
         return 0
      endif
   endif

   if ::oSysMenu != nil .and. nWParam < 61440           // 0xF000
      ::oSysMenu:Command( nWParam )
   else
      do case
         case nWParam == SC_CLOSE .or. nWParam == SC_CLOSE_OPEN
              return ::End()
      endcase
   endif

return nil


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8417
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby Antonio Linares » Sun Feb 26, 2006 7:48 pm

Enrico,

Thanks! :)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41469
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Enrico Maria Giordano » Fri Mar 03, 2006 1:02 pm

And for the same reason you may need to add:

Code: Select all  Expand view
   if ::ClassName() = "TMDIFRAME"
      for i = 1 to Len( ::oWndClient:aWnd )
         if ::oWndClient:aWnd[ i ]:oBar != nil
            AEval( ::oWndClient:aWnd[ i ]:oBar:aControls, { | oCtl | If( oCtl:ClassName() == "TBTNBMP", oCtl:LostFocus(), ) } )
         endif
      next
   endif

   if ::ClassName() = "TDIALOG"
      AEval( ::aControls, { | oCtl | If( oCtl:ClassName() == "TBTNBMP", oCtl:LostFocus(), ) } )
   endif


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8417
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 141 guests

cron