hi,
does o:SetCheck() work when it is use as POPUP Menu
if Yes, how
#include "FiveWin.ch"
function Main()
local oWnd
DEFINE WINDOW oWnd MENU BuildMenu()
ACTIVATE WINDOW oWnd
return nil
function BuildMenu()
local oMenu, oItem
MENU oMenu
MENUITEM "test"
MENU
MENUITEM "One"
MENU
MENUITEM "First" ACTION oItem:SetCheck( .T. )
MENUITEM "Second"
ENDMENU
MENUITEM oItem PROMPT "Two"
MENUITEM "Three"
ENDMENU
ENDMENU
return oMenu
#include "FiveWin.ch"
function Main()
local oWnd, oBtn
DEFINE WINDOW oWnd MENU BuildMenu()
oBtn := TButton() :new(10, 10, "press me", oBtn,, 500,200,,,, .T. )
oBtn:bAction := { | oCtrl, nRow, nCol, nKeyFlags | ;
BUILDMENU2( oCtrl, nRow, nCol, nKeyFlags ) }
ACTIVATE WINDOW oWnd
return nil
function BuildMenu()
local oMenu, oItem
MENU oMenu
MENUITEM "test"
MENU
MENUITEM "One"
MENU
MENUITEM "First" ACTION IF(oItem:lChecked ,;
oItem:SetCheck ( .F.) ,;
oItem:SetCheck ( .T.) )
MENUITEM "Second"
ENDMENU
MENUITEM oItem PROMPT "Two"
MENUITEM "Three"
ENDMENU
ENDMENU
return oMenu
function BuildMenu2(oCtrl, nRow, nCol)
local oMenu, oItem
MENU oMenu POPUP
MENUITEM "test"
MENU
MENUITEM "One"
MENU
MENUITEM "First" ACTION IF(oItem:lChecked ,;
oItem:SetCheck ( .F.) ,;
oItem:SetCheck ( .T.) )
MENUITEM "Second"
ENDMENU
MENUITEM oItem PROMPT "Two"
MENUITEM "Three"
ENDMENU
ENDMENU
ACTIVATE POPUP oMenu OF oCtrl AT nRow, nCol
return oMenu
Jimmy wrote:hi,
does o:SetCheck() work when it is use as POPUP Menu
#include "FiveWin.ch"
static lChecked := .F.
function Main()
local oWnd, oBtn
DEFINE WINDOW oWnd MENU BuildMenu()
oBtn := TButton() :new(10, 10, "press me", oBtn,, 500,200,,,, .T. )
oBtn:bAction := { | oCtrl, nRow, nCol, nKeyFlags | ;
BUILDMENU2( oCtrl, nRow, nCol, nKeyFlags ) }
ACTIVATE WINDOW oWnd
return nil
function BuildMenu()
local oMenu, oItem
MENU oMenu
MENUITEM "test"
MENU
MENUITEM "One"
MENU
MENUITEM "First" ACTION oItem:SetCheck( ! oItem:lChecked )
MENUITEM "Second"
ENDMENU
MENUITEM oItem PROMPT "Two"
MENUITEM "Three"
ENDMENU
ENDMENU
return oMenu
function BuildMenu2(oCtrl, nRow, nCol)
local oMenu, oItem
MENU oMenu POPUP
MENUITEM "test"
MENU
MENUITEM "One"
MENU
MENUITEM "First" ACTION oItem:SetCheck( lChecked := ! lChecked )
MENUITEM "Second"
ENDMENU
if lChecked
MENUITEM oItem PROMPT "Two" CHECKED
else
MENUITEM oItem PROMPT "Two"
endif
MENUITEM "Three"
ENDMENU
ENDMENU
ACTIVATE POPUP oMenu OF oCtrl AT nRow, nCol
return oMenu
Antonio Linares wrote:Here you have your example modified to work as you want:
- Code: Select all Expand view
static lChecked := .F.
if lChecked
MENUITEM oItem PROMPT "Two" CHECKED
else
MENUITEM oItem PROMPT "Two"
endif
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Google [Bot] and 86 guests