About Store Forum Documentation Contact



Post Reply 
Node<CMenuElm>: Single Check
Author Message
Driklyn Offline
Member

Post: #1
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
Find all posts by this user Quote this message in a reply
Esenthel Online
Administrator

Post: #2
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
Find all posts by this user Quote this message in a reply
Driklyn Offline
Member

Post: #3
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
Find all posts by this user Quote this message in a reply
Esenthel Online
Administrator

Post: #4
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
Find all posts by this user Quote this message in a reply
Driklyn Offline
Member

Post: #5
RE: Node<CMenuElm>: Single Check
Well that was easy, once you know how to do it. Thanks!
05-13-2011 08:18 PM
Find all posts by this user Quote this message in a reply
Post Reply