Shortcuts with contextual menus

Posts: 1
Joined: 2018-02-01
Location: United States

I have added a custom user button to the Data Browser. This custom button creates a popup contextual menu. I have programmed the menu, and I have a function associated with a keyboard shortcut. I am not able to use the shortcut to fire the function.

Here is some minimalist code that demonstrates the issue I'm having.

static function IgorStartOrNewHook(igorApplicationNameStr)
  string igorApplicationNameStr
  Execute/Q "CreateBrowser"
  Execute/Q "ModifyBrowser appendUserButton={Button, \"myButton()\", 1}, echoCommands=0"
function myButton()
  PopupContextualMenu/N "Button"
Menu "Button", ContexualMenu
  "Do it/1", /Q, doIt()
function doIt()
  print "Do it!"

If I click the button, "Do it!" is correctly printed. If I try the shortcut, the function does not execute. If I remove ContextualMenu from the Menu option, then I get a new option in the toolbar, and my shortcut fires correctly.

Am I implementing this incorrectly? Or is this a bug?


JimProuty's picture
Posts: 662
Joined: 2007-07-19
Location: United States

Shortcuts work only if the menu is in the menubar. Shortcuts don't work for contextual menus.

--Jim Prouty
Software Engineer, WaveMetrics, Inc.

Posts: 88
Joined: 2009-11-01
Location: Canada

Where in the manual can I learn about data browser buttons? I can't find it, and didn't figure out how to run the example code from kgord.

Posts: 811
Joined: 2007-03-01
Location: United States

In Igor 7, you can execute:

DisplayHelpTopic "Managing Data Browser User-Defined Buttons"

Back to top