FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour menu checked same menuitem
Posts: 7318
Joined: Thu Oct 18, 2012 07:17 PM

menu checked same menuitem

Posted: Tue Mar 14, 2023 08:27 AM

I wish create a menu popu having the same item check ( from the same)

static ltipo1:=.f.

static ltipo2:=.f.

then from a btnbmp open a menu popup with 2 option

Function BtnPop()

local oItem1,oItem2

MENU oMenu POPUP

MENUITEM oItem1 "First" ACTION oItem:SetCheck( ltipo1 := ! ltipo1 ) CHECKED

SEPARATOR

MENUITEM oItem2 "Second" ACTION oItem2:SetCheck( ltipo2 := ! ltipo2 ) CHECKED

        ENDMENU

return oMenu

why it is not compiled ?

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM

Re: menu checked same menuitem

Posted: Tue Mar 14, 2023 11:52 AM

what compile error do you get ?

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM

Re: menu checked same menuitem

Posted: Tue Mar 14, 2023 12:26 PM
Silvio.Falconi wrote:I wish create a menu popu having the same item check ( from the same)
static ltipo1:=.f.
static ltipo2:=.f.

then from a btnbmp open a menu popup with 2 option

Function BtnPop()
local oItem1,oItem2
MENU oMenu POPUP
MENUITEM oItem1 "First" ACTION oItem:SetCheck( ltipo1 := ! ltipo1 ) CHECKED
SEPARATOR
MENUITEM oItem2 "Second" ACTION oItem2:SetCheck( ltipo2 := ! ltipo2 ) CHECKED
ENDMENU
return oMenu


why it is not compiled ?
Try
Code (fw): Select all Collapse
Function BtnPop()
local oItem1,oItem2
MENU oMenu POPUP
MENUITEM oItem1 PROMPT "First" ACTION oItem:SetCheck( ltipo1 := ! ltipo1 ) CHECKED
SEPARATOR
MENUITEM oItem2 PROMPT "Second" ACTION oItem2:SetCheck( ltipo2 := ! ltipo2 ) CHECKED
ENDMENU
return oMenu
Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo

El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
Posts: 7318
Joined: Thu Oct 18, 2012 07:17 PM

Re: menu checked same menuitem

Posted: Tue Mar 14, 2023 01:26 PM
Now I have all items checked



I made
static lTipo1:=.f.,ltipo2:=.f.


@ 10, 550 BTNBMP oTipo PROMPT....
oTipo:baction:= {|Self|::ShowPopUp( { |oBtn| BtnPopMenu( oBrw,oMisura,lTipo1,lTipo2 ) } )}


Function BtnPopMenu(oBrw,oDbf,lTipo1,lTipo2)
local oItem1,oItem2
MENU oMenu POPUP
MENUITEM oItem1 PROMPT "First" ACTION (oItem1:SetCheck( ltipo1 := ! ltipo1 ),;
Maketree(oDbf,oBrw)) CHECKED
SEPARATOR
MENUITEM oItem2 PROMPT "Second" ACTION oItem2:SetCheck( ltipo2 := ! ltipo2 ) CHECKED
ENDMENU
return oMenu
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com

Continue the discussion