It does so by changing to the busy cursor, blocking user input, and darkening the screen (glass pane) with a message. The glass pane can be optionally turned off.
Sample:
- Code: Select all
//NOTE: BE SURE TO USE A TRY/FINALLY BLOCK! (or else an exception will cause the client to need a restart)
try{
plugins.busy.busy('Processing... please wait.'); // show the message on a glass pane and in the status area. Also, show a busy cursor
// or plugins.busy.busy('Processing... please wait.', false); // show the message in the status area (no glass pane). Also, show a busy cursor
// or plugins.busy.busy(null, true); // show a blank glass pane and status area. Also, show a busy cursor
// or plugins.busy.busy(); // just show a busy cursor
// do some process intensive work here
application.sleep(3000); //for example :)
}finally{
plugins.busy.ready();
}
New: Cancel support!
Cancel test code (note: the third arg enables the cancel button):
- Code: Select all
//NOTE: BE SURE TO USE A TRY/FINALLY BLOCK! (or else an exception will cause the client to need a restart)
try{
for(var i=0;i<20;i++)
{
plugins.busy.busy('Processing... please wait. ' + i,true,true);
application.sleep(500)
if(plugins.busy.isCanceled())
{
plugins.busy.busy('Canceling...');
application.sleep(400)
break;
}
}
}finally{
plugins.busy.ready();
}
Note: you can also use this as a progress indicator by calling the busy function multiple times to update the message.
The code has been tested on Mac OSX using Servoy 3.0
Should work on other platforms (in theory). Let me know if not :)[/b]