menu checked same menuitem

menu checked same menuitem

Postby Silvio.Falconi » Tue Mar 14, 2023 8: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 November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 7090
Joined: Thu Oct 18, 2012 7:17 pm

Re: menu checked same menuitem

Postby Antonio Linares » Tue Mar 14, 2023 11:52 am

what compile error do you get ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42203
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: menu checked same menuitem

Postby cnavarro » 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: Select all  Expand view  RUN

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
User avatar
cnavarro
 
Posts: 6552
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: menu checked same menuitem

Postby Silvio.Falconi » Tue Mar 14, 2023 1:26 pm

Now I have all items checked

Image

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 November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 7090
Joined: Thu Oct 18, 2012 7:17 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 93 guests

cron