Share your ideas for the JMP Scripting Unsession at Discovery Summit by September 17th. We hope to see you there!
Choose Language Hide Translation Bar
Highlighted
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
Highlighted
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
Highlighted
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

Article Labels

    There are no labels assigned to this post.