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
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);
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.
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:
action_list = {};
for (i = 1, i <= nrows(dt), i++,
bb_text = "action_list = button box(\!"Open\!", print(i))";
eval(parse(bb_text));
col box("Action", action_list),
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");
bb_text = "action_col << append(button box(\!"Open\!", print(i)))";
Now you have the column that you can add to the table.
Thanks so much MS! I took your code and changed it slightly so that each button is the "Go" icon:
bb_text = "";
bc = "b" || char(i);
bb_text = bb_text || bc || " = button box(\!"\!", print(\!"" || bc || "\!"); ), ";
col_box_expr = "col box(\!"Action\!"," || bb_text || " )";
eval(parse(col_box_expr)),
button_expr = bc || " << set icon(\!"Go\!")";
eval(parse(button_expr));
Very cool result. Clicking on a button shows which button was pressed.
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.
cool !!!