cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Sign-in to the JMP Community will be unavailable intermittently Dec. 6-7 due to a system update. Thank you for your understanding!
  • We’re retiring the File Exchange at the end of this year. The JMP Marketplace is now your destination for add-ins and extensions.
  • JMP 19 is here! Learn more about the new features.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar

How to set the name of a text box as a variable?

Hi,

I want the new window to have a few tabs on each tab that will have a text box from which I get a value for the corresponding tab.
Currently in the program I wrote all the text boxes of the same name and therefore the value is obtained from the text box in the last tab.
How do I define the name of the text box as a variable?

This is the code I wrote -

 

Chart_func = function( {Layer},
vlistbox(Outline Box(Layer),
H List Box( Text Box( "enter NEW CL: " ), theBinNumber = Number Edit Box() ),
Button Box( "OK", NEW_CL = theBinNumber << get)
));

MTK72Mon_TAB = Tab Box(
	"  TIN_LD  ", Chart_func("TIN_LD"),
	"  TIN_HD  ", Chart_func("TIN_HD"),
	"  CU 225A  ", Chart_func("CU_225A"),
	); 

MTK72_Mon_charts = new window ("MTK72 Mon",hlistbox("Title"),	MTK72Mon_TAB);
1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: How to set the name of a text box as a variable?

You need to provide a unique pointer to each of the elements in each of the Tab Boxes.  Below is one way to do that

counter = 0;

Chart_func = function( {Layer},
counter++;
eval(Substitute(
		Expr(
			V List Box(
				Outline Box( Layer ),
				H List Box( Text Box( "enter NEW CL: " ), __theBinNumber__ = Number Edit Box() ),
				Button Box( "OK", __NEW_CL__ = __theBinNumber__ << get )
			)
		),
	Expr( __theBinNumber__ ), Parse( "theBinNumber" || Char( counter ) ),
	Expr( __NEW_CL__ ), Parse( "NEW_CL" || Char( counter ) )
))
);

MTK72Mon_TAB = Tab Box(
	"  TIN_LD  ", Chart_func("TIN_LD"),
	"  TIN_HD  ", Chart_func("TIN_HD"),
	"  CU 225A  ", Chart_func("CU_225A"),
	); 

MTK72_Mon_charts = new window ("MTK72 Mon",hlistbox("Title"),	MTK72Mon_TAB);
Jim

View solution in original post

2 REPLIES 2
txnelson
Super User

Re: How to set the name of a text box as a variable?

You need to provide a unique pointer to each of the elements in each of the Tab Boxes.  Below is one way to do that

counter = 0;

Chart_func = function( {Layer},
counter++;
eval(Substitute(
		Expr(
			V List Box(
				Outline Box( Layer ),
				H List Box( Text Box( "enter NEW CL: " ), __theBinNumber__ = Number Edit Box() ),
				Button Box( "OK", __NEW_CL__ = __theBinNumber__ << get )
			)
		),
	Expr( __theBinNumber__ ), Parse( "theBinNumber" || Char( counter ) ),
	Expr( __NEW_CL__ ), Parse( "NEW_CL" || Char( counter ) )
))
);

MTK72Mon_TAB = Tab Box(
	"  TIN_LD  ", Chart_func("TIN_LD"),
	"  TIN_HD  ", Chart_func("TIN_HD"),
	"  CU 225A  ", Chart_func("CU_225A"),
	); 

MTK72_Mon_charts = new window ("MTK72 Mon",hlistbox("Title"),	MTK72Mon_TAB);
Jim

Re: How to set the name of a text box as a variable?

Thank you very much, you really helped me!!!

Recommended Articles