Hey,
i am trying to build a very small UI component in JSL after not doing this for quite a number of years and i find my self struggling.
I have a list of tables in a listbox, and i want to display a description of the table when it is selected in the listbox,
Here is a minimal example:
tables = {"Table1", "Table2"};
descriptions = {"This is the first table", "This is the second"};
showDescription = Function({},{sel, selIdx, desc},
sel = item_disp_box << Get Selected;
If(Nitems(sel) > 0,
selIdx = loc(tables,sel[1])[1];
desc = descriptions[selIdx];
tb << Set Text(desc);
);
);
nw = new window("Browse Tables",
spacer box(size(0, 5)),
hlistbox(
panelbox("Tables:",
spacer box(size(0, 5)),
item_disp_box = listbox(tables, width(200), nlines(5), max selected(1)),
//item_disp_box << On Something??(showDescription),
),
panelbox("Description of selected table:",
tb = Text Box(""),
),
);
);
You can see that i've experimented with a function that will display the correct description in the code above and that works fine if i run it manually.
My problem is that i can't find a good trigger for that function for the listbox. I've been trough the scripting index and i can only find "on close".
Is there an easy way to achieve what I am looking for here?
Thanks in advance,
Daniel