This discussion and the enclosed scripts were instigated by:
I voted for Vince's wish for a TextEditBox autocompleter since it was similar to my "wish" for a built-in ListBox filter. I had programmed specific UI's (dialogs/windows) achieving similar functionality for both items. However, I decided to try creating a function to automatically build these "widgets", and once successful, determine if a Class can be defined to take the place of a function.
There are 3 scripts attached:
- TEB_LB_Widget.jsl - This script defines supporting functions and two main functions to build these widgets: MakeLBFilter() and MakeTEBSelector().
- TestMakeLBFilter.jsl - This script includes the script above (you will need to change the path to the location of that script), then builds a simple window with two different list boxes, then creates a listbox filter for each. Note the script has wait statements, just for demonstration. There are several test case at the bottom of the script. (Code snippet and display shown below.)
- TestTEBSelector.jsl - This is similar to script 2. Check the indcluded path. This widget is less developed.
Both widgets could have additional features added, but I decided to pursuit the question of whether each widget and its features can be created as instances of a user defined Class.
I read the discussion Object Oriented JSL Examples 8/18/2016. The syntax still has not "clicked" with me, and I am looking for direction on:
- Can a JMP class be used to define an object widget? In this case, the class needs an existing object ( and likely its container) and a function to add a new object, and in each case a list.
- If yes, a class is a better way to go, and someone has a simple example or a link to documentation other than that included in the 2016 link, I would appreciate it. Then I'll pursuit the conversion. I am adding names, from the 2016 discussion: @drewfoglia , @Phil_Brown, @msharp
@vince_faller , I agree with your wish list, a built-in would be best. However, it would be nice to know how to prototype new examples.
Names Default to Here(1);
Include("C:\temp\TEB_LB_Widget.jsl");
myList1 = {"cat", "dog", "head", "cow", "heel", "help"};
dt = Open("$sample_data/semiconductor capability.jmp",Invisible);
myList2 = dt << get column names("Continuous", "string");
nw = New Window( "Example ListBox Filter",
HListBox(
VlistBox(
lb1 = ListBox(mylist1,
<<set size(100,200),
<<set auto stretching( 1, 1 ),
<<set min size( 5, 20 ),
<<set max size( 100000, 10000 )
)), //end lb1, VListBox
SpacerBox(Size(50,10)),
VListBox(
lb2 = ListBox(mylist2,
<<set size(200, 200),
<<set auto stretching( 1, 1 ),
<<set min size( 5, 20 ),
<<set max size( 100000, 10000 )
) ),//end lb2 VListBox
SpacerBox(Size(20,10) ),
) //end HListBox
);
wait(2);
lb_filt1 = MakeLBFilter(lb1);
wait(5);
lb_filt2 = MakeLBFilter(lb2);
No text - full list displayed
Left uses "Contains", right uses "Starts With"