- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
How to Set a Check Box to default on?
Hi,
I am building a simple interface for the user and have a window to set some options using check boxes. I would like to have the boxes checked by default. How is this done. The manual mentions a depreciated dialog box that allows setting of a default and recommends using modal window instead. There appears to be no straightforward method described in the manual to achieve same functionality.
How should it be done?
Andy
New Window( "Input Required", <<Modal,
VlistBox(align("Center"),
Text Box("Set Preferences"),
Pref =Check Box({"Remove Single Value","Remove Duplicates","Group by Name"},1),
spacer box(size(200,20)),
Hlistbox(2,
Button Box( "OK",
RV=Pref<<get(1);
RD=Pref<<get(2);
GR=Pref<<get(3);
),
Button Box( "Cancel",
stop();
)
))
);
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How to Set a Check Box to default on?
Here is an example setting your first check box to being on
New Window( "Input Required", <<Modal,
VlistBox(align("Center"),
Text Box("Set Preferences"),
Pref =Check Box({"Remove Single Value","Remove Duplicates","Group by Name"},1),
spacer box(size(200,20)),
pref<<set(1,1);
Hlistbox(2,
Button Box( "OK",
RV=Pref<<get(1);
RD=Pref<<get(2);
GR=Pref<<get(3);
),
Button Box( "Cancel",
stop();
)
))
);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How to Set a Check Box to default on?
Here is an example setting your first check box to being on
New Window( "Input Required", <<Modal,
VlistBox(align("Center"),
Text Box("Set Preferences"),
Pref =Check Box({"Remove Single Value","Remove Duplicates","Group by Name"},1),
spacer box(size(200,20)),
pref<<set(1,1);
Hlistbox(2,
Button Box( "OK",
RV=Pref<<get(1);
RD=Pref<<get(2);
GR=Pref<<get(3);
),
Button Box( "Cancel",
stop();
)
))
);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How to Set a Check Box to default on?
I would suggest you add some verbiage to the manual to explain this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How to Set a Check Box to default on?
You need to add this request to the JMP Wish List. I, like you, am just a JMP user, not an employee for JMP.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How to Set a Check Box to default on?
There is already a solution in the scripting guide, by the way:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How to Set a Check Box to default on?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How to Set a Check Box to default on?
This version sets all of the checkboxes to checked, regardless of how many are in your list.
New Window( "Input Required", <<Modal,
V List Box(
align( "Center" ),
Text Box( "Set Preferences" ),
Pref = Check Box( {"Remove Single Value", "Remove Duplicates", "Group by Name"}),
Spacer Box( size( 200, 20 ) ),
H List Box(
Button Box( "OK",
RV = Pref << get( 1 );
RD = Pref << get( 2 );
GR = Pref << get( 3 );
),
Button Box( "Cancel", Stop() )
),
),
pref_list = pref << get items;
for (i = 1, i <= nitems(pref_list), i++,
pref << set(i, 1);
),
);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How to Set a Check Box to default on?
Ha! Never mind. Yes, you do need the iteration in this case.
Ignore: Do you need the explicit iteration at the end? Just send the message to the list and it will distribute it to each of its items.
(pref << get items) << set( 1 );
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How to Set a Check Box to default on?
Sorry Mark but that doesn't work. I should have checked (ar ar ar) the scripting index. Use set all.
New Window( "Input Required", <<Modal,
V List Box(
align( "Center" ),
Text Box( "Set Preferences" ),
Pref = Check Box( {"Remove Single Value", "Remove Duplicates", "Group by Name"}),
Spacer Box( size( 200, 20 ) ),
H List Box(
Button Box( "OK",
RV = Pref << get( 1 );
RD = Pref << get( 2 );
GR = Pref << get( 3 );
),
Button Box( "Cancel", Stop() )
),
),
pref << set all(1)
);