cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Submit your abstract to the call for content for Discovery Summit Americas by April 23. Selected abstracts will be presented at Discovery Summit, Oct. 21- 24.
Discovery is online this week, April 16 and 18. Join us for these exciting interactive sessions.
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!!!