Subscribe Bookmark RSS Feed

Need help with getting input from a Text Edit Box

elad

Occasional Contributor

Joined:

Oct 26, 2017

Hi All, 

I need help with getting input from a "Text Edit Box". After the user inputs the Lot Number (Lot_Num variable), i wanna use it as a numaric/text value. when i try to print Lot_Num, i can see that the output is not the string the user put in the "Text Edit Box".

This value will need to be placed in a new row for existing data table.

 

User_Input = New Window( "Enter Lot Number",
Text Box( "Enter Lot Num:" ),
Lot_Num = Text Edit Box( "", <<set width( 200 ) ),
Button Box( "Click To Save", User_Input << close window ),
);
Print( Lot_Num );

 

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson

Super User

Joined:

Jun 22, 2012

Solution

The "Lot_Num" variable that you are referencing, is not the value of the Text Edit Box(), but rater a pointer to the object.  Here is an example from

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

Names Default To Here( 1 );
win = New Window( "Example",
	fontobj = text = Text Box( "Example Text" )
);
Print( text << Get Text() );
Jim
3 REPLIES
txnelson

Super User

Joined:

Jun 22, 2012

Solution

The "Lot_Num" variable that you are referencing, is not the value of the Text Edit Box(), but rater a pointer to the object.  Here is an example from

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

Names Default To Here( 1 );
win = New Window( "Example",
	fontobj = text = Text Box( "Example Text" )
);
Print( text << Get Text() );
Jim
elad

Occasional Contributor

Joined:

Oct 26, 2017

Did the trick. Thx...

pmroz

Super User

Joined:

Jun 23, 2011

The lot_num variable points to the text edit box, not the text itself.  Here's some code that shows how to get the value, and also uses a modal window so that processing stops until you click OK.

User_Input = New Window( "Enter Lot Number", << modal(),
	hlistbox(
		Text Box( "Enter Lot Num:" ),
		Lot_Num_teb = Text Edit Box( "", <<set width( 200 ) ),
	),
	text box("Click OK to save"),
	Button Box( "OK", 
		lot_num = lot_num_teb << get text();
	),
);
Print( Lot_Num );