If I click on menu I can modify When clause only in menu and not in Buttonbar.
The same thing happens in buttonbar.
The question is: How can I act both on the menu and on the button bar?
lAccess is a Local variable and the user can use either the menu or button bar
King regards
Marco
- Code: Select all Expand view
- #include "Fivewin.ch"
FUNCTION MAIN()
LOCAL oMain
LOCAL oMenu
LOCAL oBar
LOCAL lAccess
LOCAL oBtnLogin, oBtnLogout
LOCAL oBtnList
lAccess := .F.
DEFINE MENU oMenu
MENU oMenu 2007
MENUITEM "&Login"
MENU 2007
MENUITEM "&Login- lAccess = True" ACTION lAccess := .T.
MENUITEM "&Login- lAccess = False" ACTION lAccess := .F.
MENUITEM "List" ACTION MsgInfo( laccess ) WHEN lAccess
ENDMENU
ENDMENU
DEFINE WINDOW oMain FROM 100 , 100 TO 500 , 500 PIXEL MENU oMenu
DEFINE BUTTONBAR oBar OF oMain SIZE 100, 100 2007
DEFINE BUTTON oBtnLogin OF oBar PROMPT "&Login- lAccess = True" ACTION lAccess := .T.
DEFINE BUTTON oBtnLogout OF oBar PROMPT "&Logout- lAccess = False" ACTION lAccess := .F.
DEFINE BUTTON oBtnList OF oBar PROMPT "&List" WHEN lAccess ACTION MsgInfo( "LIST" )
ACTIVATE WINDOW oMain
RETURN NIL