cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JMP is taking Discovery online, April 16 and 18. Register today and join us for interactive sessions featuring popular presentation topics, networking, and discussions with the experts.
Choose Language Hide Translation Bar
WendyLou315
Level III

Is it possible to update Text Box based on Combo Box Selection

Hello!  I am new to JSL and trying to develop a tool for an engineering group.  What we'd like to do is to pull data from a table and display the results of one record based on a selection of items available.  I have developed a super simple version and cannot get it to work.  Is it even possible to update a Text Box in a window based on a selection made in a Combo Box.  << Reshow is not doing what I had hoped it would.  If this isn't possible, are there any other options? 

 

Here is the code I'm trying to learn from:

update = expr(cb << Get Selected;
	tb2 << reshow); //refresh code

TestArray = {"This", "That", "The Other"}; //my list of 'stuff'

nw = New Window("Sample", << Modal,
	vlb = V List Box(
		cb = Combo Box(TestArray //my list of 'stuff' in a combo box
		),
		hlb = H List Box (
			tb1 = Text Box (" You selected: "),  //label
				tb2 = Text Box (cb << Get Selected;), //return the current item
				update; //call to refresh the text box (but it doesn't)
			//I have named all display boxes in hopes that <<reshow of one of them 
			//would be the ticket.  Nothing worked the way I wanted.
		)
	)
)
1 ACCEPTED SOLUTION

Accepted Solutions

Re: Is it possible to update Text Box based on Combo Box Selection

Try this:

 

TestArray = {"This", "That", "The Other"}; //my list of 'stuff'
string = "You Selected:  This";

nw = New Window( "Sample",
	<<Modal,
	vlb = V List Box(
		cb = Combo Box(
			TestArray,
			choice = cb << Get Selected;
			show(string);
			string = "You Selected:  " || choice;
			tb1 << Set Text( string );
		),
tb1 = Text Box(string)
	)
);

best,

 

M

View solution in original post

4 REPLIES 4

Re: Is it possible to update Text Box based on Combo Box Selection

Try this:

 

TestArray = {"This", "That", "The Other"}; //my list of 'stuff'
string = "You Selected:  This";

nw = New Window( "Sample",
	<<Modal,
	vlb = V List Box(
		cb = Combo Box(
			TestArray,
			choice = cb << Get Selected;
			show(string);
			string = "You Selected:  " || choice;
			tb1 << Set Text( string );
		),
tb1 = Text Box(string)
	)
);

best,

 

M

txnelson
Super User

Re: Is it possible to update Text Box based on Combo Box Selection

I will add to Mark's comments that you can see exellent examples for all of the elements available to Text Edit Boxes and all other display object in the Scripting Index.  It makes working with JSL object much easier

     Help==>Scripting Index==>Text Edit Box

Jim
WendyLou315
Level III

Re: Is it possible to update Text Box based on Combo Box Selection

Thanks, txnelson! I will certainly do that and keep referring to the Scripting Index as I continue to learn JSL.
WendyLou315
Level III

Re: Is it possible to update Text Box based on Combo Box Selection

Thank you SO very much M_Anderson. That worked beautifully. Now to fit it to my exact needs. I can't begin to express how thrilled I am. I'm truly looking forward to learning more about JSL!