Old 12-11-2016, 08:21 PM   #1
tack
Human being with feelings
 
tack's Avatar
 
Join Date: Jan 2014
Posts: 236
Default gfx.showmenu() and nested submenu bug? (FIXED)

Hi all,

I am trying to construct a menu that looks like:
Code:
- Toplevel 1
   - Nested
         - Inner
- Toplevel 2
The menu syntax for showmenu() says to prefix the item with < to indicate it's the last item in a submenu. However above I want 'Inner' to terminate two submenus (Nested and Toplevel 1).

Near as I can tell, Reaper doesn't support this kind of structure? I have tried the obvious:

Code:
>Toplevel 1|>Nested|<<Inner|Toplevel 2
To no avail. The only workaround I could see is:

Code:
>Toplevel 1|>Nested|<Inner|<|Toplevel 2
But because of the empty item, there is a separator at the bottom of Submenu.

I think this could be fixed easily enough: just have |<| semantically mean terminate a submenu. This would also allow this grammar, equivalent to the above, which is superior IMO as it's more friendly to programmatic generation of the menu string.

Code:
>Toplevel 1|>Nested|Inner|<|<|Toplevel 2

Last edited by tack; 12-11-2016 at 08:32 PM.
tack is offline   Reply With Quote
Old 12-11-2016, 08:57 PM   #2
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 1,055
Default

Use >< to make Nested the start of a submenu and the last one in its parent menu.

Code:
gfx.showmenu('>Toplevel 1|><Nested|<Inner|Toplevel 2')
cfillion is online now   Reply With Quote
Old 12-11-2016, 08:57 PM   #3
schwa
Administrator
 
schwa's Avatar
 
Join Date: Mar 2007
Location: NY
Posts: 9,057
Default

We'll add this for 5.31, thanks.

gfx.showmenu(">first|>second|<third|<|first again")

(this essentially amounts to making sure the last item in a submenu is not a separator)
schwa is offline   Reply With Quote
Old 12-11-2016, 09:01 PM   #4
tack
Human being with feelings
 
tack's Avatar
 
Join Date: Jan 2014
Posts: 236
Default

Thanks cfillion. Indeed this does work, but I hope what won't discourage schwa from adding the support anyway because the way I suggested is significantly easier to programmatically build the menu string.
tack is offline   Reply With Quote
Old 12-11-2016, 09:02 PM   #5
tack
Human being with feelings
 
tack's Avatar
 
Join Date: Jan 2014
Posts: 236
Default

Quote:
Originally Posted by schwa View Post
gfx.showmenu(">first|>second|<third|<|first again")

(this essentially amounts to making sure the last item in a submenu is not a separator)
But if for some reason you really wanted the last item to be a separator, you could do:

Code:
gfx.showmenu(">first|>second|third||<|<|first again")

Last edited by tack; 12-11-2016 at 09:08 PM.
tack is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 09:13 PM.


Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2017, vBulletin Solutions, Inc.