|RetargetAction behavior with command/handler/menu extension points [message #732313]
||Tue, 04 October 2011 13:29
| Ovidio Mallo
Registered: July 2009
I want to achieve a functionality similar to the one of RetargetActions
but using the newer command/handler/menu extensions but I'm having some
problems when the command is displayed in the view toolbars of multiple
Let's assume that I have the following:
- 2 different views, one for Person objects, the other for Address objects
- 1 delete command (for deleting Persons or Addresses)
- 1 key binding for the delete command
- 2 menu contributions which contribute the delete command to the
_toolbar_ of both views
- 2 handlers, one for deleting Persons, one for deleting Addresses
- each handler has an activeWhen clause which only activates the handler
if the respective view (Person/Address) is active
The problem I'm encountering is that since I have (and need) an
activeWhen clause for the two handlers, the icon of the delete command
always gets disabled when the containing view does not have the focus.
While this is exactly what the activeWhen clause described above
enforces, it somehow looks strange in the UI since those icons always
get disabled when the view looses the focus but you can still click them
and launch the corresponding handler. The latter works since when you
click on the "disabled" icon, the view first gets the focus and then the
icons all of a sudden get enabled. To me, this behavior is a bit
confusing for commands contributed to view toolbars.
My question is whether I can somehow achieve that the icons in the
toolbar only get disabled based on the enabledWhen clause of the handler
but *not* depending on the activeWhen clause? Or is there any other
workaround for this problem?
Thanks a lot in advance for any help!
Powered by FUDForum
. Page generated in 0.01398 seconds