Page 1 of 6
Add sub-menu support for scripts
Posted: 26 Aug 2016 15:32
by waqu
Add the ability to create sub-menus in scripts.
Re: Add sub-menu support for scripts
Posted: 26 Aug 2016 18:47
by bdeshi
you could use popupmenu()
Re: Add sub-menu support for scripts
Posted: 26 Aug 2016 21:36
by FluxTorpedoe
Hi’
And if you have more complex needs for dynamic menus or submenus,
load $YourMenu, , "s" and
heredoc syntax also come in handy, e.g.:
Code: Select all
"Regular Entry"
msg 0;
"Submenu Entry<tab>>"
// ------------------>
$Menu = <<<#>>>
"Submenu First Entry"
msg 1;
"Submenu Second Entry"
msg 2;
#>>>;
load $Menu, , "s";
// ------------------<
Have a nice day,
Flux
Re: Add sub-menu support for scripts
Posted: 29 Aug 2016 07:47
by highend
+99!
Thanks @SammaySarkar & FluxTorpedoe!
But... A native way for real menu structures would be greatly preferred...
- If you switch to a submenu, the whole main menu is gone (hard to grasp what else you could have clicked, even more so for larger menus)
- While it's possible to get the main menu back you can't do it without adding another "..\" entry for each submenu (or however you'd name it)
Re: Add sub-menu support for scripts
Posted: 29 Aug 2016 09:59
by admin
Got an idea for how to do this. Planned for 17.20...
Re: Add sub-menu support for scripts
Posted: 29 Aug 2016 10:01
by highend
Re: Add sub-menu support for scripts
Posted: 30 Aug 2016 23:31
by highend
@Flux
Can you create multiple nested submenus with your method?
Like:
Root menu entry 1
Sub menu 1
....Entry a
....Entry b
....Sub menu 2
........Entry c
Root menu entry 2
Re: Add sub-menu support for scripts
Posted: 31 Aug 2016 02:33
by FluxTorpedoe
highend wrote:Can you create multiple nested submenus with your method?
Wicked…
Never needed it before, but here it is, an example with sub-sub-menu and embedded warnings:
— Variables must be quoted when used (else they are resolved prematurely)
— Even XY vars, especially <crlf> (which breaks heredoc menus)

- XY_Submenus.png (38.98 KiB) Viewed 3867 times
Code: Select all
"Main Menu A1"
msg "Main Menu A1";
// --------------------------->
"Main Menu A2<tab>>"
$var = "foo;bar";
$Menu = <<<#>>>
"Submenu B1"
msg "Submenu B1";
// ------------------>
"Submenu B2<tab>>"
$SubMenu = <<<#)))
"SubSubmenu C1 [Regular]"
msg "C1";
"SubSubmenu C2 [Vars not quoted => risk of error]"
msg $var;
"SubSubmenu C3 [All vars quoted => OK]"
msg "$var";
"SubSubmenu C4 [Even CRLF => use chr(13)]"
msg "First line".chr(13)."Second Line";
#)));
load $SubMenu, , "s";
// ------------------<
#>>>;
load $Menu, , "s";
// ---------------------------<
[/size]
———————————————————————————
admin wrote:Got an idea for how to do this. Planned for 17.20...
Cool news!
Have a nice day,
Flux
Re: Add sub-menu support for scripts
Posted: 31 Aug 2016 08:20
by highend
Cool Flux and thanks a lot for providing the example! Now the only thing I have to do is build a clever parser
Now the only thing I have to do is build a clever parser
Done

Re: Add sub-menu support for scripts
Posted: 31 Aug 2016 13:33
by highend
Works nicely (these are generated by UMC...)

Clicking on files / folders lead to a different menu...

- GIF.gif (69.48 KiB) Viewed 3840 times
Re: Add sub-menu support for scripts
Posted: 31 Aug 2016 16:15
by klownboy
Hey highend, how's it going? I see you must be still tweaking UMC. I'm still using it daily. When are we, or maybe for now I should say I, going to see another update.
It would be nice though if Don could give us fly-out sub-menus on mouse hovering where the original menus stayed visible.

Re: Add sub-menu support for scripts
Posted: 31 Aug 2016 17:41
by highend
Hi Ken. Everything's fine here. Didn't had much time for UMC in the past. But I've added a few features recently (one of them is obviously nested submenus) and menus got a "match" property as well so that rebuilding XY's tree and list menus became possible. Unfortunately not all menu entries have an internal XY ID so I need to add scripts to recreate the same functionality

Re: Add sub-menu support for scripts
Posted: 28 Oct 2016 11:44
by admin
admin wrote:Got an idea for how to do this. Planned for 17.20...
Next beta supports multiple nested submenus with SC popupmenu()...

Re: Add sub-menu support for scripts
Posted: 28 Oct 2016 11:47
by highend
While you're (already) on it, can you add icon support for popupmenu() as well? Too many people like those shiny little (distracting) thingies...
Re: Add sub-menu support for scripts
Posted: 28 Oct 2016 13:27
by admin
You mean toolbar icons?