Subscribe Bookmark RSS Feed

Grid Control in JMP Dialog Boxes?

pmroz

Super User

Joined:

Jun 23, 2011

Hi folks,

Has anyone figured out how to do some sort of grid control in JMP dialog boxes?  Something similar to SCgrid in VB?  I want to display a scrollable table with clickable controls in it.

Thanks,

Peter

1 ACCEPTED SOLUTION

Accepted Solutions
Solution

Just action_list[1] works but not the entire list. Thus, Col Box() seems unable to resolve a List of display boxes which usually means that one has to make and parse an enormous expression string.

dt = open("$sample_data\Car Physical Data.jmp");

current data table(dt);

model_list   = :Model << get values;

Country_list = :Country << get values;

type_list    = :Type << get values;

weight_list  = :Weight << get values;

turn_list    = :Turning Circle << get values;

disp_list    = :Displacement << get values;

horse_list   = :Horsepower << get values;

gas_list     = :Gas Tank Size << get values;

bb_text="button box(\!"Open\!", print(1))";;

for (i = 2, i <= nrows(dt), i++,

      bb_text = bb_text||", "||char(substitute(nameexpr(button box("Open", print(expr(i)))),expr(i),i));    

);

col_box="col box(\!"Action\!", "||bb_text||")" ;

New Window( "Cars",

      tb = Table Box(

                 eval(parse(col_box)),

                  String Col Box("Model", model_list),

                  String Col Box("Country", country_list),

                  String Col Box("Type", type_list),

                  Number Col Box("Weight", weight_list ),

                  Plot Col Box( "", weight_list),

                  Number Col Box("Turning Circle", turn_list ),

                  Number Col Box("Displacement", disp_list ),

                  Number Col Box("Horsepower", horse_list ),

                  Number Col Box("Gas Tank Size", gas_list ),

                  Plot Col Box( "", gas_list),

      )

);

tb << Set Scrollable( 25, 0 );

tb << table style(beveled);


7 REPLIES
XanGregg

Staff

Joined:

Jun 23, 2011

In JMP 10, Table Box has a Set Scrollable message and Col Box which is a display table column where each row is a different display box of your choosing.

Another option, which I haven't tried, is putting a Lineup Box inside a Scroll Box.

pmroz

Super User

Joined:

Jun 23, 2011

Almost there.  Didn't know about col box, which is not documented anywhere except for a brief mention in Help > Scripting Index.  Maybe someone can help me get this example to work:

dt = open("$sample_data\Car Physical Data.jmp");

current data table(dt);

model_list   = :Model << get values;

Country_list = :Country << get values;

type_list    = :Type << get values;

weight_list  = :Weight << get values;

turn_list    = :Turning Circle << get values;

disp_list    = :Displacement << get values;

horse_list   = :Horsepower << get values;

gas_list     = :Gas Tank Size << get values;

action_list = {};

for (i = 1, i <= nrows(dt), i++,

      bb_text = "action_list = button box(\!"Open\!", print(i))";

      eval(parse(bb_text));

);

New Window( "Cars",

      tb = Table Box(

                  col box("Action", action_list),

                  String Col Box("Model", model_list),

                  String Col Box("Country", country_list),

                  String Col Box("Type", type_list),

                  Number Col Box("Weight", weight_list ),

                  Plot Col Box( "", weight_list),

                  Number Col Box("Turning Circle", turn_list ),

                  Number Col Box("Displacement", disp_list ),

                  Number Col Box("Horsepower", horse_list ),

                  Number Col Box("Gas Tank Size", gas_list ),

                  Plot Col Box( "", gas_list),

      )

);

tb << Set Scrollable( 25, 0 );

tb << table style(beveled);

Solution

Just action_list[1] works but not the entire list. Thus, Col Box() seems unable to resolve a List of display boxes which usually means that one has to make and parse an enormous expression string.

dt = open("$sample_data\Car Physical Data.jmp");

current data table(dt);

model_list   = :Model << get values;

Country_list = :Country << get values;

type_list    = :Type << get values;

weight_list  = :Weight << get values;

turn_list    = :Turning Circle << get values;

disp_list    = :Displacement << get values;

horse_list   = :Horsepower << get values;

gas_list     = :Gas Tank Size << get values;

bb_text="button box(\!"Open\!", print(1))";;

for (i = 2, i <= nrows(dt), i++,

      bb_text = bb_text||", "||char(substitute(nameexpr(button box("Open", print(expr(i)))),expr(i),i));    

);

col_box="col box(\!"Action\!", "||bb_text||")" ;

New Window( "Cars",

      tb = Table Box(

                 eval(parse(col_box)),

                  String Col Box("Model", model_list),

                  String Col Box("Country", country_list),

                  String Col Box("Type", type_list),

                  Number Col Box("Weight", weight_list ),

                  Plot Col Box( "", weight_list),

                  Number Col Box("Turning Circle", turn_list ),

                  Number Col Box("Displacement", disp_list ),

                  Number Col Box("Horsepower", horse_list ),

                  Number Col Box("Gas Tank Size", gas_list ),

                  Plot Col Box( "", gas_list),

      )

);

tb << Set Scrollable( 25, 0 );

tb << table style(beveled);


danschikore

Staff

Joined:

Sep 21, 2012

Col Box is similar to Outline Box in it's arguments.  You could build up the list similar to the way Peter did:

action_col = col box("Action");

for (i = 1, i <= nrows(dt), i++,

      bb_text = "action_col << append(button box(\!"Open\!", print(i)))";

      eval(parse(bb_text));

);

Now you have the column that you can add to the table.

pmroz

Super User

Joined:

Jun 23, 2011

Thanks so much MS!  I took your code and changed it slightly so that each button is the "Go" icon:

dt = open("$sample_data\Car Physical Data.jmp");

current data table(dt);

model_list   = :Model << get values;

Country_list = :Country << get values;

type_list    = :Type << get values;

weight_list  = :Weight << get values;

turn_list    = :Turning Circle << get values;

disp_list    = :Displacement << get values;

horse_list   = :Horsepower << get values;

gas_list     = :Gas Tank Size << get values;

action_list = {};

bb_text = "";

for (i = 1, i <= nrows(dt), i++,

    bc = "b" || char(i);

    bb_text = bb_text || bc || " = button box(\!"\!", print(\!"" || bc || "\!"); ), ";

);

col_box_expr = "col box(\!"Action\!"," || bb_text || " )";

New Window( "Cars",

    tb = Table Box(

            eval(parse(col_box_expr)),

            String Col Box("Model", model_list),

            String Col Box("Country", country_list),

            String Col Box("Type", type_list),

            Number Col Box("Weight", weight_list ),

            Plot Col Box( "", weight_list),

            Number Col Box("Turning Circle", turn_list ),

            Number Col Box("Displacement", disp_list ),

            Number Col Box("Horsepower", horse_list ),

            Number Col Box("Gas Tank Size", gas_list ),

            Plot Col Box( "", gas_list),

    )

);

tb << Set Scrollable( 25, 0 );

tb << table style(beveled);

for (i = 1, i <= nrows(dt), i++,

    bc = "b" || char(i);

    button_expr = bc || " << set icon(\!"Go\!")";

    eval(parse(button_expr));

);

Very cool result.  Clicking on a button shows which button was pressed.

2558_Cars with Buttons.png

gatovolador

Community Member

Joined:

Feb 27, 2012

Here is an alternative approach, using a LineupBox filled with BorderBoxes, MouseBoxes, and TextBoxes that acts like a table.  The MouseBox can provide the clickable controls and the BorderBox can provide the ability to colorize the table cells.

KinKame

Community Trekker

Joined:

Nov 30, 2015

cool !!!