Hi Guilherme, Guilherme Aiolfi wrote: > I thought it(qooxdoo) could choose the action for me. qooxdoo has a lot of built-in magic but on this topic it can't help you :-)
> Here is how I think it > should be done: When hitting a shortcut, it would be looking for the layout > items related (buttons) and would choose the one that is visible at the > moment (that would be the right choose every time). If two buttons are > visible at the same time, then fire two actions, but in that case, it's ok. > If the action is linked to a menu item, than test if the menu is visible. > And if the command is not linked to any layout item, than works for the > whole application. Commands get disabled automatically whenever the widget to which they are bound to gets disabled. Additionally you can disable the command itself. So if you enable/disable your widgets you can achieve that only the command bound to the enabled widget is executed. So it boils down to two possible solutions for you: either you disable the command itself when the widget is hidden or you disable the widget (and/or hide it). Only hiding the widget won't stop the command from executing. Hope this helps, Alex > > 2008/8/25 Alexander Back <[EMAIL PROTECTED]> > >> Hi Guilherme, >> >> Guilherme Aiolfi wrote: >>> Can't I create 2 commands with the same shortcut? >>> >>> For example, >>> >>> I have this StackLayout with 2 layers. Both have its own toolbar with a >>> "back" button. And I want to use "Escape" to both. >>> >>> Is it possible? >> Short answer: yes. If you create two command objects both of them will >> listen to the shortcut key and both will fire the "execute" event you >> can listen to. >> >> But you should definetely think your approach over. In most cases it is >> not intented to execute two actions when hitting one shortcut. You >> cannot distinguish which action the user wanted to start, because the >> commands simply fire whenever the keyboard shortcut is hit. Figuring out >> which action is the right to choose could be difficult, I think. >> >> cheers, >> Alex ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ qooxdoo-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
