1. New style menus
- Posted by petelomax at blueyonder.co.uk Sep 09, 2002
- 427 views
{{{ I have some horror such as below. Shorter/simpler;;; and/or a smoother en/disabling by groups?
I'm sure someone said there was now an easier way...
Pete
code starts
global constant
FileMenu = create( Menu, "&File", MAIN, 0,0,0,0,0), FileNew create( MenuItem, "&New\t(Ctrl N)", FileMenu, 0,0,0,0,0), FileOpen = create( MenuItem, "&Open\t(Ctrl O)", FileMenu, 0,0,0,0,0), FileClos create( MenuItem, "&Close", FileMenu, 0,0,0,0,0), FileSave = create( MenuItem, "&Save\t(Ctrl S)", FileMenu, 0,0,0,0,0), FileSvAs = create( MenuItem, "Save &As", FileMenu, 0,0,0,0,0), FileSep1 = create( MenuItem, "-", FileMenu, 0,0,0,0,0), FilePrnt = create( MenuItem, "&Print\t(Ctrl P)", FileMenu, 0,0,0,0,0), FileSep2 = create( MenuItem, "-", FileMenu, 0,0,0,0,0), FileExit = create( MenuItem, "E&xit", FileMenu, 0,0,0,0,0), EditMenu create( Menu, "&Edit", MAIN, 0,0,0,0,0), EditUndo = create( MenuItem, "&Undo\t(Ctrl Z)", EditMenu, 0,0,0,0,0), EditRedo = create( MenuItem, "&Redo\t(Ctrl Y)", EditMenu, 0,0,0,0,0), EditSep1 create( MenuItem, "-", EditMenu, 0,0,0,0,0), EditCut create( MenuItem, "Cu&t\t(Ctrl X)", EditMenu, 0,0,0,0,0), EditCuta = create( MenuItem, "Cut Append\t(Ctrl Shift X)", EditMenu, 0,0,0,0,0), EditCopy create( MenuItem, "&Copy\t(Ctrl C)", EditMenu, 0,0,0,0,0), EditCopa = create( MenuItem, "Copy Append\t(Ctrl Shift Y)", EditMenu, 0,0,0,0,0), EditPste = create( MenuItem, "&Paste\t(Ctrl V)", EditMenu, 0,0,0,0,0), EditSelA = create( MenuItem, "Select &All\t(Ctrl A)", EditMenu, 0,0,0,0,0), EditSelW = create( MenuItem, "Select &Word\t(Ctrl W)", EditMenu, 0,0,0,0,0), EditSep2 create( MenuItem, "-", EditMenu, 0,0,0,0,0), EditCmnt create( MenuItem, "Co&mment", EditMenu, 0,0,0,0,0), EditUncm = create( MenuItem, "U&ncomment", EditMenu, 0,0,0,0,0), EditSep3 = create( MenuItem, "-", EditMenu, 0,0,0,0,0), EditIncI = create( MenuItem, "&Increase Indent", EditMenu, 0,0,0,0,0), EditDecI = create( MenuItem, "&Decrease Indent", EditMenu, 0,0,0,0,0), EditSep4 = create( MenuItem, "-", EditMenu, 0,0,0,0,0), EditFind = create( MenuItem, "&Find\t(Ctrl F)", EditMenu, 0,0,0,0,0), 0,0,0,0,0), EditFnxt = create( MenuItem, "Find &Next\t(F3)", EditMenu, 0,0,0,0,0), EditFprv = create( MenuItem, "Find &Prior\t(Shift F3)", EditMenu, 0,0,0,0,0), EditFfsl create( MenuItem, "Find Fir&st Selected\t(Ctrl F3)", EditMenu, 0,0,0,0,0), EditFnsl = create( MenuItem, "Find Nex&t Selected\t(Ctrl Shift F3)", EditMenu, 0,0,0,0,0), ToolMenu = create( Menu, "&Tools", MAIN, 0,0,0,0,0), ToolBind = create( MenuItem, "&Bind", ToolMenu, 0,0,0,0,0), ToolSep1 = create( MenuItem, "-", ToolMenu, 0,0,0,0,0), ToolRun = create( MenuItem, "&Run\t(F5)", ToolMenu, 0,0,0,0,0), ToolErr = create( MenuItem, "&Jump to Error\t(F12)", ToolMenu, 0,0,0,0,0), ToolSep2 = create( MenuItem, "-", ToolMenu, 0,0,0,0,0), ToolComp = create( MenuItem, "&Compare", ToolMenu, 0,0,0,0,0), ToolDcmp create( MenuItem, "&Directory Compare+", ToolMenu, 0,0,0,0,0), ToolSep3 = create( MenuItem, "-", ToolMenu, 0,0,0,0,0), ToolFFle = create( MenuItem, "&Find in Files+", ToolMenu, 0,0,0,0,0), ToolSep4 create( MenuItem, "-", ToolMenu, 0,0,0,0,0), ToolMcro create( MenuItem, "&Macro+", ToolMenu, 0,0,0,0,0), ToolSep5 create( MenuItem, "-", ToolMenu, 0,0,0,0,0), ToolFmat create( MenuItem, "F&ormat+", ToolMenu, 0,0,0,0,0), ToolSep6 = create( MenuItem, "-", ToolMenu, 0,0,0,0,0), ListAll = create( MenuItem, "List &All Routines+", ToolMenu, 0,0,0,0,0), ListGlob = create( MenuItem, "List &Global Routines+", ToolMenu, 0,0,0,0,0), ListIncl create( MenuItem, "List &Include files+", ToolMenu, 0,0,0,0,0), ListInGl = create( MenuItem, "List I&ncluded Globals+", ToolMenu, 0,0,0,0,0), ListSect = create( MenuItem, "List &Sections+", ToolMenu, 0,0,0,0,0), OptMenu create( Menu, "&Options", MAIN, 0,0,0,0,0), OptClrs = create( MenuItem, "&Colours", OptMenu, 0,0,0,0,0), OptFont = create( MenuItem, "&Font+", OptMenu, 0,0,0,0,0), OptKeybd create( MenuItem, "&Keyboard+", OptMenu, 0,0,0,0,0), OptRefs = create( MenuItem, "&References+", OptMenu, 0,0,0,0,0), OptShtSt create( MenuItem, "&Shutdown and Startup+", OptMenu, 0,0,0,0,0), OptStats create( MenuItem, "S&tatus bar+", OptMenu, 0,0,0,0,0), OptSyntx = create( MenuItem, "S&yntax Colouring+", OptMenu, 0,0,0,0,0), HelpMenu create( Menu, "&Help", MAIN, 0,0,0,0,0), HelpCont = create( MenuItem, "&Contents+", HelpMenu, 0,0,0,0,0), HelpKybd = create( MenuItem, "&Keyboard\t(F1)", HelpMenu, 0,0,0,0,0), HelpEuph = create( MenuItem, "&Euphoria Reference Manual+", HelpMenu, 0,0,0,0,0), Helpwn32 = create( MenuItem, "&Win32lib+", HelpMenu, 0,0,0,0,0), HelpSep1 = create( MenuItem, "-", HelpMenu, 0,0,0,0,0), HelpUGrp = create( MenuItem, "&User Group+", HelpMenu, 0,0,0,0,0), HelpSep2 create( MenuItem, "-", HelpMenu, 0,0,0,0,0), HelpAbt create( MenuItem, "&About+", HelpMenu, 0,0,0,0,0)
global procedure updateMainMenu(atom enable)
2. Re: New style menus
- Posted by Derek Parnell <ddparnell at bigpond.com> Sep 09, 2002
- 380 views
Pete, the setEnable() and setVisible() both support the following syntax... setEnable(sequence IDLIST, integer flag) eg. ==code starts == global constant FileMenu = create( Menu, "&File", MAIN, 0,0,0,0,0), FileNew = create( MenuItem, "&New\t(Ctrl N)", FileMenu, 0,0,0,0,0), FileOpen = create( MenuItem, "&Open\t(Ctrl O)", FileMenu, 0,0,0,0,0), FileClos = create( MenuItem, "&Close", FileMenu, 0,0,0,0,0), FileSave = create( MenuItem, "&Save\t(Ctrl S)", FileMenu, 0,0,0,0,0), FileSvAs = create( MenuItem, "Save &As", FileMenu, 0,0,0,0,0), FileSep1 = create( MenuItem, "-", FileMenu, 0,0,0,0,0), FilePrnt = create( MenuItem, "&Print\t(Ctrl P)", FileMenu, 0,0,0,0,0), FileSep2 = create( MenuItem, "-", FileMenu, 0,0,0,0,0), FileExit = create( MenuItem, "E&xit", FileMenu, 0,0,0,0,0), FileMenuIds = {FileNew, FileOpen, FileClos, FileSave, FileSvAs, FilePrnt, FileExit}, . . . global procedure updateMainMenu(atom enable) -- -- Called from files.e to enable/disable most of the main menu when -- some/no open files -- setEnable(FileMenuIds & EditMenuIds & ..., enable) end procedure --------- Cheers, Derek Parnell