Driklyn
Member
|
Node<CMenuElm>: Single Check
How do we make the elements of a Node<CMenuElm> allow only 1 checkmark? (i.e. clicking one sets the checkmark to that element and removes the checkmark from the previous one, like in Code Editor > Configuration)
I can't figure this out. Everything I try seems to have no effect.
(This post was last modified: 05-13-2011 05:43 AM by Driklyn.)
|
|
05-13-2011 05:40 AM |
|
Esenthel
Administrator
|
RE: Node<CMenuElm>: Single Check
void Set(int i)
{
set cmenu element "1" as (i==1)
set cmenu element "2" as (i==2)
}
void Set1()
{
Set(1);
}
void Set2()
{
Set(2);
}
void createmenu()
{
node "1" func Set1
node "2" func Set2
}
|
|
05-13-2011 07:48 AM |
|
Driklyn
Member
|
RE: Node<CMenuElm>: Single Check
What exactly do you mean by this:
Code:
void Set(int i)
{
set cmenu element "1" as (i==1)
set cmenu element "2" as (i==2)
}
I've tried doing "elm.setOn(true);" but it never toggles the checkmark. Only works when I create the node, can't seem to update it manually after creation...
(This post was last modified: 05-13-2011 09:05 AM by Driklyn.)
|
|
05-13-2011 09:05 AM |
|
Esenthel
Administrator
|
RE: Node<CMenuElm>: Single Check
Menu::
void operator()(Str command, Bool on, Bool quiet=false); // set 'command' 'on' state (checked), sample usage: ("View/Wireframe",true), 'quiet'=if apply the value in quiet mode (if set to true then 'func' will not be called)
menu("view/1", i==1, true);
menu("view/2", i==2, true);
|
|
05-13-2011 09:35 AM |
|
Driklyn
Member
|
RE: Node<CMenuElm>: Single Check
Well that was easy, once you know how to do it. Thanks!
|
|
05-13-2011 08:18 PM |
|