cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar
Neo
Neo
Level VI

Reset Text Edit Box to empty when rest button is pressed

I would like to reset the Text Edit Box to empty using the reset button in the script below. How to do this?

 

Names Default To Here( 1 );
clear log ();
nw = New Window( "Get Data",
	<<Modal,
	<<Return Result,
	pid = Text Edit Box( "", <<Set Width( 160 ) ),
	Button Box ("Get ID & Data",
	ID = pid << get text;
	show (ID)),
	//getData (ID); run getData script. Get data script will go here.
	Button Box("Reset", /* Reset script to reset text edit box to empty*/),
	Button Box("Cancel", dialog("Cancelled by User"));
);
When it's too good to be true, it's neither
3 ACCEPTED SOLUTIONS

Accepted Solutions
mmarchandTSI
Level V

Re: Reset Text Edit Box to empty when rest button is pressed

You can do this with the <<Set Text() message.

 

Names Default To Here( 1 );
clear log ();
nw = New Window( "Get Data",
	<<Modal,
	<<Return Result,
	pid = Text Edit Box( "", <<Set Width( 160 ) ),
	Button Box ("Get ID & Data",
	ID = pid << get text;
	show (ID)),
	//getData (ID); run getData script. Get data script will go here.
	Button Box("Reset", pid << Set Text( "" ) ),
	Button Box("Cancel", dialog("Cancelled by User"));
)

View solution in original post

mmarchandTSI
Level V

Re: Reset Text Edit Box to empty when rest button is pressed

 

lb << Remove All;

 

(My List Box is named lb)

 

 

I found this using

 

 

Show Properties( lb )

 

It's very helpful in situations like this.

 

 

mmarchandTSI_0-1697040174325.png

 

View solution in original post

jthi
Super User

Re: Reset Text Edit Box to empty when rest button is pressed

You can disable display boxes using << Enable(0) and set it to 1 when it can be modified and then use << Set Text Changed or << Set function with text edit box

Names Default To Here(1);
win = New Window("Example", 
	teb = Text Edit Box("", << Set Text Changed(function({this, value},
		btn << Enable(!IsMissing(value));
	))),
	btn = Button Box("OK", << Enable(0))
);
-Jarmo

View solution in original post

12 REPLIES 12
mmarchandTSI
Level V

Re: Reset Text Edit Box to empty when rest button is pressed

You can do this with the <<Set Text() message.

 

Names Default To Here( 1 );
clear log ();
nw = New Window( "Get Data",
	<<Modal,
	<<Return Result,
	pid = Text Edit Box( "", <<Set Width( 160 ) ),
	Button Box ("Get ID & Data",
	ID = pid << get text;
	show (ID)),
	//getData (ID); run getData script. Get data script will go here.
	Button Box("Reset", pid << Set Text( "" ) ),
	Button Box("Cancel", dialog("Cancelled by User"));
)
Neo
Neo
Level VI

Re: Reset Text Edit Box to empty when rest button is pressed

@mmarchandTSI That is simple. Thanks. While, we are here, How would one reset a List Box if it was populated with a list of items?

When it's too good to be true, it's neither
mmarchandTSI
Level V

Re: Reset Text Edit Box to empty when rest button is pressed

As in clear the selection in the list box or clear the items leaving none to select?  If you'd like to know what messages any certain display box can take, try

Show Properties( diplayboxname )
Neo
Neo
Level VI

Re: Reset Text Edit Box to empty when rest button is pressed

@mmarchandTSI  needs to be clear the items leaving none to select. 

(Sorry should have been more specific in my last post)

When it's too good to be true, it's neither
mmarchandTSI
Level V

Re: Reset Text Edit Box to empty when rest button is pressed

 

lb << Remove All;

 

(My List Box is named lb)

 

 

I found this using

 

 

Show Properties( lb )

 

It's very helpful in situations like this.

 

 

mmarchandTSI_0-1697040174325.png

 

Neo
Neo
Level VI

Re: Reset Text Edit Box to empty when rest button is pressed

Show Properties ()

 is one of the best piece of advice I have received here. Many thanks. 

 

When it's too good to be true, it's neither
Neo
Neo
Level VI

Re: Reset Text Edit Box to empty when rest button is pressed

<< Remove All () does empty the list.

When it's too good to be true, it's neither
hogi
Level XII

Re: Reset Text Edit Box to empty when rest button is pressed

This should work:

New Window( "Example",
	lb =
	List Box(
		{"First Item", "Second Item", "Third Item"},
		max selected( 2 ),
	)
);
lb << Set Selected( 2 );
lb << Set Selected( 3 );

selected items = (lb << Get Selected Indices);
for each({index},selected items, lb<<  set selected (index, 0) )
jthi
Super User

Re: Reset Text Edit Box to empty when rest button is pressed

Remove All

jthi_0-1697088647843.png

 

Clear Selection

jthi_1-1697088660832.png

In this case (definitely not always the case) both are documented in scripting index with working examples (remove all example is quite clunky as it doesn't use wait to let user see what it does).

Easiest way (in my opinion) to find these is to search for ListBox and then from "Item name matches" try different List Box options AND check from left side until you get the correct object (in this case it is ListBoxBox, you might have to do this by trial and error and experience of using scripting index).

jthi_2-1697088761600.png

After you have the correct object clicked, CLEAR your search text and press enter. You end up with the messages related to that object

jthi_3-1697088810887.png

 

It does take some time to learn, how to use, scripting index in different ways of searching for information (it is worth it if you do JMP scripting).

-Jarmo