Can a custom menu be activated from within a procedure


Procedure windows have no Action menu item. Is it possible to set up a custom menu which can be selected from within a procedure? I’ve tried, using

filemenubar ..., menu(...) + menuitem(...)

and it doesn’t work. I suspect it may not be possible.


It’s not documented, but if you set the third parameter of the filemenubar statement to "PROCEDURE_MENUBAR", you can completely change the menus in a procedure window (in fact, this is how Panorama X sets up the menus in the first place. Here is the code that would set up the standard procedure window menus.

filemenubar "",standardfilemenu(
    "Preview One Record","="+menuitem("Preview One Record","enabled",false()),
    "Print One Record","="+menuitem("Print One Record…","enabled",false())
    menuitem("Shift Selection Left","ACTION","unindentSelection:","KEY","[")+
    menuitem("Shift Selection Right","ACTION","indentSelection:","KEY","]")+
    menuitem("Add Mark","CODE","insertnewproceduremark")+
    arraymenuitems(tagarray(info("proceduretext"),"//[--","--]",cr()),"CODE",{proceduresearchexact "//[--"+|||«»|||+"--]" if error beep stop endif})+
    menuitem("Single Step","ACTION","toolSingleStep:","KEY","D")+
    menuitem("Check Procedure","ACTION","toolCheckProcedure:","KEY","1")+
    menuitem("Dialog Workshop…","CODE",{openwizard "Dialog Workshop"})+

Be careful – if you mess this up you might not be able to edit procedures any more in this database! Also, the code above is still undocumented even though I am posting it here, and it could (probably will) change in future releases.


Wow - that looks scary - I think I’ll look for a safer approach to my problem.