|Enabling/Disabling a command [message #559076]
||Wed, 15 September 2010 14:17
| Giddi Ohm
Registered: September 2010
I'm new to SWT so please bare with me.|
How do I disable a command based on a state in my program? I have PLAY command which puts my application in a play-state after the command has been confirmed by the user. I've created a STOP command and put it on a toolbar and assigned a handler to it, but the isEnabled() method isn't called often enough.
The STOP command's isEnabled() method is invoked immediately before and after the dialog is shown (most likely a result of the application window losing and gaining focus), but not after my code has regained control. Hence the stop button is never enabled.
I want to achieve something like this in my PLAY handler:
//state == IDLE;
// somehow enable the STOP command
I have looked at the command service class but there seems to be no method of triggering an enable-evaluation of all commands. I've tried with and without enabledWhen to no avail.
I have no problems doing this with actions or action delegates, but I want to learn how to use commands from the beginning even though the framework seems overly complex for standard applications.
Powered by FUDForum
. Page generated in 0.06889 seconds