Making shortcut for the menu that include sub-menues

Hi, I am trying to make a customized menu.

I have menus with submenues.
I understand how to make a short cut for the submenues, but still I cannot find way to make a shortcut for the menu.

For Instance,

Menu 1
Menu 2
Submenu 2.1
Submenu2.2

In this case, I understand how to make shortcut for menu1 and submenues, but not for Menu2.
Is there any way to make a shortcut for Menu2?
Could you please post a minimal example and OS info (win or mac). I'm not sure whether you are talking about mnemonic keystrokes or accelerators.
HJ
I am using mac and I am trying to customize the menu as follows

menu "My functions"
"Menu1/1", Function1()
Submenu "Submenu1"
"Submenu1-1 /S1", Sub1-1()
"Submenu1-2", Sub1-2()
end
End

I would like to add shortcut to "Submenu1" by putting "/2" but it doesn't work
Is there any way to make a shortcut to the submenu?

HJDrescher wrote:
Could you please post a minimal example and OS info (win or mac). I'm not sure whether you are talking about mnemonic keystrokes or accelerators.
HJ
Hi,

As a test I created this code:
menu "My functions"
"Menu1/1", Function1()
Submenu "Submenu1"
"Submenu1-1 /S1", Sub1_1()
"Submenu1-2 /S2", Sub1_2()
end
end

function function1()
end

function Sub1_1()
end
function Sub1_2()
end


And got the result you requested, I think. See Image.
Menu Test.png (75.48 KB)
Thanks for your input and apology for the confusion.
I meat that can I put the short cut for "submenu1" instead of "submenu1-1" or "Submenu1-2"

Thanks!


hegedus wrote:
Hi,

As a test I created this code:
menu "My functions"
"Menu1/1", Function1()
Submenu "Submenu1"
"Submenu1-1 /S1", Sub1_1()
"Submenu1-2 /S2", Sub1_2()
end
end

function function1()
end

function Sub1_1()
end
function Sub1_2()
end


And got the result you requested, I think. See Image.

I am not sure that request makes sense from an user interface perspective. The submenu heading does [not] have a function attached to to execute. It serves as an organizational heading.

What action are you going to initiate with a shortcut to a submenu?

Andy
I guess you want mnemonic keystrokes: 'alt-y', 's' would open the user defined menu and submenu1 on WINDOWS.
menu "M&y functions"
"Menu1/1", Function1()
Submenu "&Submenu1"
"Submenu1-1 /S1", Sub1_1()
"Submenu1-2 /S2", Sub1_2()
end
end
 
function function1()
end
 
function Sub1_1()
end
function Sub1_2()
end


To cite the manual:

Note: The mnemonic keystroke is not supported on Macintosh. For this reason, if you care about cross-platform compatibility, you should not use ampersands in your menu items.
On Macintosh, if you use a single ampersand in a menu item, it does not appear in the menu item. If you use a double-ampersand, it appears as a single ampersand.

@WM: Igor8 ?

HJ
I am trying to make a more convenient Interface by selecting menus by shortcuts to enable to choose the submenus.


hegedus wrote:
I am not sure that request makes sense from an user interface perspective. The submenu heading does [not] have a function attached to to execute. It serves as an organizational heading.

What action are you going to initiate with a shortcut to a submenu?

Andy

Thanks! This is what I want to make, but sadly it seems not to be available in Mac...
Thank you so much otherwise I may keep trying to find some way...


HJDrescher wrote:
I guess you want mnemonic keystrokes: 'alt-y', 's' would open the user defined menu and submenu1 on WINDOWS.
menu "M&y functions"
"Menu1/1", Function1()
Submenu "&Submenu1"
"Submenu1-1 /S1", Sub1_1()
"Submenu1-2 /S2", Sub1_2()
end
end
 
function function1()
end
 
function Sub1_1()
end
function Sub1_2()
end


To cite the manual:

Note: The mnemonic keystroke is not supported on Macintosh. For this reason, if you care about cross-platform compatibility, you should not use ampersands in your menu items.
On Macintosh, if you use a single ampersand in a menu item, it does not appear in the menu item. If you use a double-ampersand, it appears as a single ampersand.

@WM: Igor8 ?

HJ