cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
SDF1
Super User

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.

DiedrichSchmidt_0-1634571310370.png

DiedrichSchmidt_1-1634571337824.png

 

  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

1 ACCEPTED SOLUTION

Accepted Solutions
ian_jmp
Staff

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])));

View solution in original post

2 REPLIES 2
ian_jmp
Staff

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])));
SDF1
Super User

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