Can't Display Keyboard Shortcuts in Popups

Peter M. Brigham pmbrig at gmail.com
Wed Apr 20 11:55:36 EDT 2016


On Apr 20, 2016, at 11:35 AM, Richard Gaskin wrote:

> Ray wrote:
> 
> > I'm unable to popup a button as a contextual menu and show keyboard
> > shortcuts.  For example, I'd like users to see "Audio  ctrl+A", not
> > just "Audio".
> >
> > The button's style is "menu" and the button's contents for that line
> > is "Audio/A".  The "Audio   ctrl+A" displays fine as long as the
> > button's "menuMode" is pulldown, but as soon as I use the popup
> > command to pop the button up contextually, it's menuMode is changed
> > to "popUp".  This loses the display of the keyboard shortcut.  I now
> > only see "Audio" instead of the desired "Audio   ctrl+A".
> >
> > Does anyone know how to keep keyboard shortcuts while using the popup
> > command?
> 
> I don't believe the OS APIs support that.  The HIGs for all supported desktop platforms suggest using context menus as a secondary convenience for items also available in the more visible menu bar.
> 
> Given that design mandate, it seems the assumption is that users can learn shortcuts when viewing the menu item in their primary location, regardless whether a subset of those items is also available in a more ephemeral secondary form such as a context menu.
> 
> On an implementation level, following the design mandate certainly makes things easier for the developer, as both LiveCode and the OS support keyboard triggers for visible menu items such as those in the menu bar, but since a popup only exists at the moment it's popped up there's no way to hook the event from the object.

Usually popup menus are really contextual menus anyway, and give the user choices that are quite dependent on the control being clicked on. They can be (and I think usually are) constructed on the fly, to allow for, eg, actions specific to a field, or even to the text chunk clicked on. Whereas keyboard shortcuts (and the menu choices associated with them) are generally more global in scope. If you really need to have shortcuts listed in a popup menu, you could construct them yourself on the fly -- on mousedown; put "Audio   ctrl+A" into btn "myPopup"; popup btn "myPopup". I don't know when this would be actually useful, but then I don't know what you're trying to do here.

-- Peter

Peter M. Brigham
pmbrig at gmail.com





More information about the use-livecode mailing list