Gui4Cli Reusing Code, the "sharemenu" way

Of course you can have your most used subroutines in one gui, say CommonRoutines.gc
and from other gui's address them as G
Gosub CommonRoutines.gc MymostusedRoutine

You can do better still.

The sharemenu command allows you to use the same menu form different Gui4Cli programs (gui's in our slang)
This is a very powerfull feature, whose power i realised only recently.

I did write a "Common Menu " program CM.gc consisting only of menu items (and the code realising the menu functions of course) .
This is how such a menu titem looks:

This one changes a directoty listview into a normal text listview

xMENU 'Listview1&2 ' 'ChangeMode ' 'Multi' '' ;
Gui_ = $$sys.aw // the currently active gui
LVNr = $$LV.ID // the currently active listview
LVUse #this $LVNr
LVMode Multi

Now i always launch this fCM.gc (Common Menus) first which make a lot of "menu power" avbailable to any new gui i write.
The same Menu now appears for any loaded & active gui having the command
sharemenu CM.gc"

Since you can easily position your gui's on anys public screen this full power is available everywhere you want it.

The submenu's are

1. The "Project" Menu about/ goal/usage/todo/small/big/quit
With some standardisation effort in routine naming the same "Project menu" About/Goal/Usage/Load/LoadfromClips/Quit is directly avaliable.

2. The "More gui's" menu from which you can launch the mostly used gui's

3. The "Status" menu with the Status command (the standard Gui4Cli interface you get from its WB appmenu)but alos Load Req/Load Last/LoadRecent/UnLoad/Close/CloseAll-/Open/OpenAll/

4. The Textin menu, allowing to copy & paste from a textin gadget on the active gui, not brilliant but

5. The " Listview" menu with some 36 commands for loading in ; inserting in , selecting lines from , deleting from, sorting, the active listview in the active gui.

I will probably split this up in "Directory LV" and " Text LV"

6. The" Info menu" showing the latest file or directory used by "any" of the loaded gui's (in the computer session) , and more traditional inf (eg the info commands output)
In fact the last file loaded in a given LV from a give gui, with the common menu is annotated (LVnr and GuiName too), so the info menu cn show the last file loaded in the active window's active LV too.

7. The "Help" menu opening help info Gui4Cli/DOS/Arexx/Python/More

8. The "Debug" menu G4DebugOn/G4DebugOff/ArexxTcOn/ArexxTcOff

9. The "ToDo" menu pointing to different todo lists allowing to easily update them.

CM.Gc also maintains the following lists:

1. LastUsedGui's
Using the Status/Load menu a limited list "LastUsedGui first" is maintained.
LoadRecent will opena Recent.gc gui showing this list from which to chose the gui you want to launch.

2. AllGui's
Using the Status/Load an alphhabetic list of all gui's is maintained This will be expanded to document their usage frequency.

3.Gui's existing at quitting Gui4Cli
On opening CM.gc the list of gui's existing at quitting are presented. The user is able to select those he wants to launch again

This "Common Menu" approach is very motivating and speeds up development (allready very high with Gui4Cli) considerably.
You see what is available directly through the menu, but the menu items also corespond to subroutines that you can call
from the active gui.

Blog post type: