|Enable/disable commands [message #559144]
||Wed, 15 September 2010 18:42
| Giddi Ohm
Registered: September 2010
How do I disable a command based on a state in my program? I have a PLAY command that 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 delegates, but I want to learn how to use commands from the beginning even though the framework seems overly complex for simple applications.
Powered by FUDForum
. Page generated in 0.01635 seconds