There's a menu option called "ID". When you specify the "ID" option for a menu item, then when the user selects it, Reginald calls your window's MENUID event handler. (This is an event handler that you'll find in your window's Event list).
Your WM_MENUID subroutine is passed 2 args. ARG(1) is the ID number for the menu item selected, and ARG(2) is the menu caption. This can be useful for implementing an MRU list.
Also, I changed GuiGetMenuOpts so that the caption you specify does not have backslashes "expanded". WARNING: I will likely change GuiAddCtl to do the same.
Here's an example script that demos the ID option for menu items.
LIBRARY rexxgui
guierr = "SYNTAX"
guiheading = 1
guicreatewindow('NORMAL')
again:
DO FOREVER
guigetmsg()
CATCH SYNTAX
CONDITION('M')
SIGNAL again
FINALLY
guidestroywindow()
END
RETURN
wm_menuid:
guisay("ID =" ARG(1) || '0D0A'x || ARG(2))
RETURN
wm_click_addfname:
guiaddmenu("A:\MyDir\My Floppy File, , , ID", "ITEM", "1 3")
guisetctlplacement("AddFname", , , , , "DISABLE")
RETURN |