|how bind commands to buttons with enabled state [message #645894]
||Tue, 21 December 2010 00:59
| Thomas F
Registered: December 2010
I've got the issue to add buttons in views - not just in toolbars, but e.g. next to input fields... Those buttons might be enabled if any input is given or not... In traditional programming I would enable/disable the buttons out of listeners of other fields. Currently I use properties like "isMyButtonEnabled" which return the value via getIsMyButtonEnabled(). If I do any changes I fire a prop change and the binding of button.enabled to this property does the update automatically. The action listeners of button perform the exectuable. Not fairly nice but works.
Nevertheless there is RCP and a framework with commands. I found how to execute commands out of buttons. BUT how to bind the enabled or visible state of a button to the command handler. For toolbar contributions e.g. the button becomes disabled if the handler is deactivated (activeWhen) or invisible (visibleWhen). How can I do this with traditional SWT buttons? And maybe how can I do this using WindowBuilder ?
Powered by FUDForum
. Page generated in 0.02371 seconds