cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JMP is taking Discovery online, April 16 and 18. Register today and join us for interactive sessions featuring popular presentation topics, networking, and discussions with the experts.
Choose Language Hide Translation Bar
Kelly
Level III

How can I get a check box to set instead of toggle?

Hello,

I am having an issue with setting checked boxes as checked. It seems to be toggling instead of setting. I have included some sample code. I create a 1 item check box in a journal, set it (the box gets checked), then set it again (the box gets unchecked).

window_journal = New Window("", <<Journal, mainPage = V List Box()    
);

EnableLimitButton = Check Box("Enable Limit Checking");
mainpage << Append (EnableLimitButton);
EnableLimitButton << set(1);
EnableLimitButton << set(1);


Is there a way to get this to set instead of toggle? I have tried using set("on") and set("true") but they do not work.

Thanks for your help!

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: How can I get a check box to set instead of toggle?

If you only reference the index, and don't specify the desired setting (0/1) then the set message works like a toggle.  If you want to use an absolute reference to select the check box, you need to specify:

EnableLimitButton << set(1,1);

Here is the example taken from the Scripting Index, on the Set message usage in the Check Box() object

     Help==>Scripting Index==>Check Box==>Set

Names Default To Here( 1 );
New Window( "Example", cb = Check Box( {"One", "Two", "Three"} ) );
cb << Set( 3, 1 );
Jim

View solution in original post

1 REPLY 1
txnelson
Super User

Re: How can I get a check box to set instead of toggle?

If you only reference the index, and don't specify the desired setting (0/1) then the set message works like a toggle.  If you want to use an absolute reference to select the check box, you need to specify:

EnableLimitButton << set(1,1);

Here is the example taken from the Scripting Index, on the Set message usage in the Check Box() object

     Help==>Scripting Index==>Check Box==>Set

Names Default To Here( 1 );
New Window( "Example", cb = Check Box( {"One", "Two", "Three"} ) );
cb << Set( 3, 1 );
Jim