Menu.toggle not working

Post

Posted
Rating:
#1 (In Topic #1277)
Avatar
Enthusiast
GrayGhost is in the usergroup ‘Enthusiast’
Am I trying to use it wrong ?

Code (gambas)

  1.  Menu_Edit_Current_Account.Toggle    '  '  This returns an error " Not An Object "
  2.  
  3. Menu_Edit_Current_Account.Checked = Not Menu_Edit_Current_Account.Checked   '   This works Fine

Image

(Click to enlarge)

Online now: No Back to the top

Post

Posted
Rating:
#2
Guru
BruceSteers is in the usergroup ‘Guru’
Yes you are using it wrong…   

 you need to set a value
/comp/gb.qt4/menu/toggle - Gambas Documentation
Gets or Sets if a menu is a toggle menu or not.
You only need to set it once.

Menu_Edit_Current_Account.Toggle = True
Menu_Edit_Current_Account.Checked = bToggleValue
Online now: No Back to the top

Post

Posted
Rating:
#3
Avatar
Enthusiast
GrayGhost is in the usergroup ‘Enthusiast’
 I have it set to Toggle in the GUI

Do I also have to set it in the code ?

Image

(Click to enlarge)

Online now: No Back to the top

Post

Posted
Rating:
#4
Avatar
Enthusiast
GrayGhost is in the usergroup ‘Enthusiast’
I guess I just don't understand how Toggle is suppose to work  :(

I thought it was to change the value from True to False or False to True       or     checked to unchecked    … but I guess that is not the purpose of it
Online now: No Back to the top

Post

Posted
Rating:
#5
Guru
BruceSteers is in the usergroup ‘Guru’
 No it is the switch that turns it into a checkbox menu.

Once it's a toggle menu it works just like a ToggleButton or a CheckBox where you use Value (and/or Checked)
Online now: No Back to the top

Post

Posted
Rating:
#6
Guru
BruceSteers is in the usergroup ‘Guru’

grayghost4 said

I have it set to Toggle in the GUI

Do I also have to set it in the code ?

No. setting it in the IDE has done that for you.  you only need to set it by code to make a new menu created by code be a Toggle Menu
Online now: No Back to the top

Post

Posted
Rating:
#7
Guru
BruceSteers is in the usergroup ‘Guru’
<IMG src="https://forum.gambas.one/download/file.php?id=1640"> </IMG>

PS.
I made up "bToggleValue" just to symbolize a boolean toggle value  ,
you'll probably want to use your own variable/condition ;)
Online now: No Back to the top

Post

Posted
Rating:
#8
Avatar
Enthusiast
GrayGhost is in the usergroup ‘Enthusiast’
I thought that ".toggle" was a shorthand for :

Code (gambas)

  1.    Menu_Edit_Current_Account.Checked = Not Menu_Edit_Current_Account.Checked
To flip the value from True to False or False to True .
now I know that is not what is for.    :D
Online now: No Back to the top
1 guest and 0 members have just viewed this.