- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
JSL help updating panel box upon change of combo box
Hi All,
I'm working on some JSL code where I'd like it to do something like the platform interface of the support vector machines (for those with Pro, for those without, the screen shots should help explain further).
I'd like the panel box that contains a combo box to update and show different options based on the user selection of the combo box. With the SVM example, I'd like to do something similar: If the user selects the first combo box option, it results in an updated panel box like that shown in the first screenshot. Then, if the user selects the next option, the panel box is updated to show the new options, like the second screenshot.
The combo boxes don't allow for the On Change() call, and I can't seem to get a Function call to work when the combo box is changed. I'm thinking of maybe doing an UpdateWindow call, but having a hard time figuring out how to do that correctly.
Any suggestions appreciated.
Thanks!,
DS
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: JSL help updating panel box upon change of combo box
This might get you started:
NamesDefaultToHere(1);
UInames = {"UI One", "UI Two"};
UIList = {PanelBox(UInames[1], TextBox("One")), PanelBox(UInames[2], TextBox("Two"))};
cb = ComboBox(UInames, << SetFunction(
Function( {this, index},
(this << sib) << delete;
this << sibAppend(Eval(UIlist[index]))
)
)
);
NewWindow("Dynamic UI", LineUpBox(NCol(1), cb, Eval(UIlist[1])));
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: JSL help updating panel box upon change of combo box
This might get you started:
NamesDefaultToHere(1);
UInames = {"UI One", "UI Two"};
UIList = {PanelBox(UInames[1], TextBox("One")), PanelBox(UInames[2], TextBox("Two"))};
cb = ComboBox(UInames, << SetFunction(
Function( {this, index},
(this << sib) << delete;
this << sibAppend(Eval(UIlist[index]))
)
)
);
NewWindow("Dynamic UI", LineUpBox(NCol(1), cb, Eval(UIlist[1])));
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: JSL help updating panel box upon change of combo box
Hi @ian_jmp ,
Thanks for the quick feedback and help. I did need to modify it a little bit so that it was only changing part of the panel box and not all of it.
This modified version is one that does what I was hoping to get, and I couldn't have done it without your snippet of code. Thank you!
Names Default To Here( 1 );
UInames = {"Option One", "Option Two"};
lublist = {Lineup Box( N Col( 3 ), Spacing( 3, 3 ), Text Box( "A" ), Text Box( "B" ), Number Edit Box( 7, 6 ) ),
Lineup Box( N Col( 3 ), Spacing( 3, 3 ), Text Box( "C" ), Text Box( "D" ), Number Edit Box( 10, 6 ) )};
cb = Combo Box(
UInames,
<<SetFunction(
Function( {this, index},
(this << sib) << delete;
this << sibAppend( Eval( lublist[index] ) );
)
)
);
nw = New Window( "Dynamic UI", Lineup Box( N Col( 1 ), Panel Box( "UI Choices", cb, Eval( Lublist[1] ) ) ) );
Thanks!,
DS