cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Browse apps to extend the software in the new JMP Marketplace
Choose Language Hide Translation Bar
robot
Level VI

Horizontal Radio Buttons

Is it possible to produce a horizontal list of Radio Buttons?  The script below will product a list of vertical Radio Buttons, but I am making a user-selection window that will have a long list of options, similar to the multiple-choice test example here​, and I think a horizontal list of Radio Buttons will be most efficient.  If necessary, I can probably use a Combo Box, but I think the Radio Buttons will be faster.

Names Default To Here( 1 );

New Window( "Example",

       rb = Radio Box(

             {"single", "double", "triple"},

             Show( rb << Get() )

       )

);

I am using JMP12, but I hope the solution will also be compatible with JMP10 and above.

Any ideas?

1 ACCEPTED SOLUTION

Accepted Solutions
pmroz
Super User

Re: Horizontal Radio Buttons

You can use the GROUP method to combine radio boxes in a horizontal fashion.  Check this out:

10674_Horizontal Radio Boxes.png

Here's the code.  If you have many entries you could use an array for all of the radio boxes.

Names Default To Here( 1 );

New Window( "Example",

      panelbox("Make a selection for each question",

            lineup box(ncol(6),

                  textbox("1. "), rb1 = radio box("A"), rb2 = radio box("B"), rb3 = radio box("C"), rb4 = radio box("D"), rb5 = radio box("E"),

                  textbox("2. "), rb6 = radio box("A"), rb7 = radio box("B"), rb8 = radio box("C"), rb9 = radio box("D"), rb10 = radio box("E"),

                  textbox("3. "), rb11 = radio box("A"), rb12 = radio box("B"), rb13 = radio box("C"), rb14 = radio box("D"), rb15 = radio box("E"),

            )

      )

);

rb1 << group(rb2);

rb1 << group(rb3);

rb1 << group(rb4);

rb1 << group(rb5);

rb6 << group(rb7);

rb6 << group(rb8);

rb6 << group(rb9);

rb6 << group(rb10);

rb11 << group(rb12);

rb11 << group(rb13);

rb11 << group(rb14);

rb11 << group(rb15);

View solution in original post

4 REPLIES 4
pmroz
Super User

Re: Horizontal Radio Buttons

You can use the GROUP method to combine radio boxes in a horizontal fashion.  Check this out:

10674_Horizontal Radio Boxes.png

Here's the code.  If you have many entries you could use an array for all of the radio boxes.

Names Default To Here( 1 );

New Window( "Example",

      panelbox("Make a selection for each question",

            lineup box(ncol(6),

                  textbox("1. "), rb1 = radio box("A"), rb2 = radio box("B"), rb3 = radio box("C"), rb4 = radio box("D"), rb5 = radio box("E"),

                  textbox("2. "), rb6 = radio box("A"), rb7 = radio box("B"), rb8 = radio box("C"), rb9 = radio box("D"), rb10 = radio box("E"),

                  textbox("3. "), rb11 = radio box("A"), rb12 = radio box("B"), rb13 = radio box("C"), rb14 = radio box("D"), rb15 = radio box("E"),

            )

      )

);

rb1 << group(rb2);

rb1 << group(rb3);

rb1 << group(rb4);

rb1 << group(rb5);

rb6 << group(rb7);

rb6 << group(rb8);

rb6 << group(rb9);

rb6 << group(rb10);

rb11 << group(rb12);

rb11 << group(rb13);

rb11 << group(rb14);

rb11 << group(rb15);

robot
Level VI

Re: Horizontal Radio Buttons

Very cool.  Thanks PMroz.

robot
Level VI

Re: Horizontal Radio Buttons

Hi PMroz,

Thanks for the grouping script.  It works great for a non-modal window.  My problem now is that if I make the window modal, it will no longer read the group functions after the window creation.  Do you have any ideas how to get around this?

Names Default To Here( 1 );

New Window( "Example",

       <<Modal,

       Panel Box( "Make a selection for each question",

             Lineup Box( N Col( 6 ),

                    Text Box( "1. " ),

                    rb1 = Radio Box( "A" ),

                    rb2 = Radio Box( "B" ),

                    rb3 = Radio Box( "C" ),

                    rb4 = Radio Box( "D" ),

                    rb5 = Radio Box( "E" ),

                    Text Box( "2. " ),

                    rb6 = Radio Box( "A" ),

                    rb7 = Radio Box( "B" ),

                    rb8 = Radio Box( "C" ),

                    rb9 = Radio Box( "D" ),

                    rb10 = Radio Box( "E" ),

                    Text Box( "3. " ),

                    rb11 = Radio Box( "A" ),

                    rb12 = Radio Box( "B" ),

                    rb13 = Radio Box( "C" ),

                    rb14 = Radio Box( "D" ),

                    rb15 = Radio Box( "E" ),

             )

       )

);

rb1 << group( rb2 );

rb1 << group( rb3 );

rb1 << group( rb4 );

rb1 << group( rb5 );

rb6 << group( rb7 );

rb6 << group( rb8 );

rb6 << group( rb9 );

rb6 << group( rb10 );

rb11 << group( rb12 );

rb11 << group( rb13 );

rb11 << group( rb14 );

rb11 << group( rb15 );

robot
Level VI

Re: Horizontal Radio Buttons

Never mind.  I put the group functions inside the window and that solved the problem.  Thanks!

Names Default To Here( 1 );

New Window( "Example",

       <<Modal,

       Panel Box( "Make a selection for each question",

             Lineup Box( N Col( 6 ),

                    Text Box( "1. " ),

                    rb1 = Radio Box( "A" ),

                    rb2 = Radio Box( "B" ),

                    rb3 = Radio Box( "C" ),

                    rb4 = Radio Box( "D" ),

                    rb5 = Radio Box( "E" ),

                    Text Box( "2. " ),

                    rb6 = Radio Box( "A" ),

                    rb7 = Radio Box( "B" ),

                    rb8 = Radio Box( "C" ),

                    rb9 = Radio Box( "D" ),

                    rb10 = Radio Box( "E" ),

                    Text Box( "3. " ),

                    rb11 = Radio Box( "A" ),

                    rb12 = Radio Box( "B" ),

                    rb13 = Radio Box( "C" ),

                    rb14 = Radio Box( "D" ),

                    rb15 = Radio Box( "E" )

             )

       ),

       rb1 << group( rb2 );

       rb1 << group( rb3 );

       rb1 << group( rb4 );

       rb1 << group( rb5 );

       rb6 << group( rb7 );

       rb6 << group( rb8 );

       rb6 << group( rb9 );

       rb6 << group( rb10 );

       rb11 << group( rb12 );

       rb11 << group( rb13 );

       rb11 << group( rb14 );

       rb11 << group( rb15 );

);