FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Little problem in TWindow
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Little problem in TWindow
Posted: Wed Feb 22, 2006 07: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.

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):

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
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Little problem in TWindow
Posted: Sun Feb 26, 2006 07:48 PM

Enrico,

Thanks! :)

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Little problem in TWindow
Posted: Fri Mar 03, 2006 01:02 PM
And for the same reason you may need to add:

   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

Continue the discussion