Choose Language Hide Translation Bar
Highlighted
FN
FN
Community Trekker

How to button press and wait until action is finished

In one addin, I am calling an .exe to perform an operation.

 

How can I avoid the user to click several times in this button but not freeze the whole JMP session.

 

Thank you.

0 Kudos
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
txnelson
Super User

Re: How to button press and wait until action is finished

I typically use the Enabled() message to disable the button until JMP detects the task the button has launched is completed.  Below is an example that disables the button for 5 seconds and then enables the button again.  Your task will be to detect when the executed task is complete.

Names Default To Here( 1 );
nw = New Window( "Example",
	bb = Button Box( "Press Me",
		bb << enabled( 0 );
		Wait( 5 );
		bb << enabled( 1 );
	)
);

You can also use the Visibility() message to do the same as above.  It does not gray out the button box like enabled() does, rather it makes the button box() invisible to the display until the Visibility() is reset.

Jim

View solution in original post

2 REPLIES 2
Highlighted
txnelson
Super User

Re: How to button press and wait until action is finished

I typically use the Enabled() message to disable the button until JMP detects the task the button has launched is completed.  Below is an example that disables the button for 5 seconds and then enables the button again.  Your task will be to detect when the executed task is complete.

Names Default To Here( 1 );
nw = New Window( "Example",
	bb = Button Box( "Press Me",
		bb << enabled( 0 );
		Wait( 5 );
		bb << enabled( 1 );
	)
);

You can also use the Visibility() message to do the same as above.  It does not gray out the button box like enabled() does, rather it makes the button box() invisible to the display until the Visibility() is reset.

Jim

View solution in original post

FN
FN
Community Trekker

Re: How to button press and wait until action is finished

Maybe we also need a try catch in case there is an error?