DoIgorMenu for submenu

Hi!

I use DoIgorMenu in order to call menus that already exists with my own shortcuts.
I would like to access submenus like the align menu for the objects in layouts, but I don't get it to work.
Here is an example of the code I have been trying to use and does not work.

Menu "Shorcut storage"
Submenu "Align"
"Vertical Centers /5",Adjustvertical_identation()
End
End

Function Adjustvertical_identation()
DoIgorMenu "Layout","Align", Vertical Centers
End

Is there a simple solution to access the build in submenu?
Thanks a lot!
youpi wrote:

I use DoIgorMenu in order to call menus that already exists with my own shortcuts.


It seems, what you are trying to do is create a main menu (Shortcut storage) with submenus (Align) that reference back to existing standard sub-menus in Igor. Perhaps you are having a sequence of common menu choices that you want to keep collected in one place for easier access???

I see one problem -- the experiment may not be in the proper state to handle the submenu call. For example here, the submenu Align only appears under certain conditions for a layout, not for a graph. Should you have a graph window at the front, nothing will happen when you try to run DoIgorMenu "Layout", "Align". So, your "Shortcut storage" menu will have to check to be sure the frontmost window is a layout, and check that multiple annotations are selected, and then it can call the DoIgorMenu "Layout", "Align" .... menu. I wonder why you do this when it is automatically done for you by Igor ... all you need is to select the Layout:Align:... submenu as needed.

The larger problem is, DoIgorMenu only accesses on level, not sublevels. Perhaps to do this, you will have to replace the DoIgorMenu call by the actual code that is performed by the submenu call you want to execute (for example a sequence of Textbox/C/.... calls). You will still need to check for everything being in the proper state before doing all this (is the front window a layout, does it contain annotations, are multiple annotations selected, what are their current locations, which way are they to be aligned .....).

So, in summary ... why do you want to make your own menu item to replace an existing menu item that works nicely already?

--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAHuntsville
It's not obvious from the documentation, but not all menus can be invoked by DoIgorMenu. Only menus that are part of the menu bar (that includes sub-menus of menus that drop down from the menu bar). Dynamic menus also can't be invoked- you can't invoke a Recent Experiment via DoIgorMenu. The Align item is actually a contextual menu attached to a button in a window; it is not part of the menu bar.

John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
jjweimer][quote=youpi wrote:

So, in summary ... why do you want to make your own menu item to replace an existing menu item that works nicely already?

--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAHuntsville



Thank you for your answer. The aim was not to have a separate menu. All I want is to be able "to align objects vertically " on a layout quickly with a shortcut such as Ctrl+5 for example.
This would allow me to work quicker on my layouts.
That is why I though that reaching the submenu directly would be a simple option.

Thanks again though,
Youpi