Replace METHOD Command in Class TMenu with this and try
( My apologies, I forgot to update the MENU.PRG file in the repository )
//----------------------------------------------------------------------------//
METHOD Command( nCommand ) CLASS TMenu
local oMenuItem := ::GetMenuItem( nCommand )
if oMenuItem != nil
if oMenuItem:lRadio
oMenuItem:SetRadioMenuItem( nCommand )
else
if ::lUserRadio
if lAnd( GetMenuState( ::hMenu, nCommand, MF_BYCOMMAND ), MF_CHECKED )
oMenuItem:SetCheck( .F. )
else
oMenuItem:SetCheck( .T. )
endif
endif
endif
if ValType( oMenuItem:bAction ) == "B"
if oMenuItem:bWhen != nil .and. ! Eval( oMenuItem:bWhen, oMenuItem )
return nil
endif
::oLastItem = oMenuItem
if ::lPopup
::oMenuItemPopup = oMenuItem
else
if oMenuItem:bAction != nil
if ValType( oMenuItem:bBlock ) == "B"
Eval( oMenuItem:bBlock, oMenuItem )
endif
Eval( oMenuItem:bAction, oMenuItem )
else
if ValType( oMenuItem:bBlock ) == "B"
Eval( oMenuItem:bBlock, oMenuItem )
endif
Eval( oMenuItem:OnClick, ::oWnd, oMenuItem )
endif
endif
else
if ValType( oMenuItem:bBlock ) == "B"
if oMenuItem:bWhen != nil .and. ! Eval( oMenuItem:bWhen, oMenuItem )
return nil
endif
::oLastItem = oMenuItem
if ::lPopup
::oMenuItemPopup = oMenuItem
endif
Eval( oMenuItem:bBlock, oMenuItem )
endif
endif
endif
return nil
//----------------------------------------------------------------------------//
Sample
#include "Fivewin.ch"
Function Main()
local oWnd
local oMnu
DEFINE WINDOW oWnd ;
TITLE "Test Menu" + " - Ver.: " + FWVERSION + if( IsExe64(), ;
" ( 64", " ( 32" ) + " bits ) - " + FWString( "User" ) + ;
": " + WNetGetUser() + " - " + hb_Compiler() ;
MENU ( oMnu := MenuTest() )
ACTIVATE WINDOW oWnd MAXIMIZED
Return nil
Function MenuTest()
local oMnu
MENU oMnu 2007
MENUITEM "One"
MENU
MENUITEM "First" BLOCK { || MsgInfo( "Hello" ) }
SEPARATOR
MENUITEM "Two" ACTION MsgInfo( "Bye" )
ENDMENU
ENDMENU
Return oMnu