Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!lll-crg!mordor!sri-spam!nike!ucbcad!ucbvax!UTAH-CS.ARPA!thomas%utah-gr From: thomas%utah-gr@UTAH-CS.ARPA (Spencer W. Thomas) Newsgroups: mod.computers.apollo Subject: Re: [munnari!cheops.OZ!tony@seismo.CSS.GOV: pop up menus] Message-ID: <8609061651.AA10239@utah-gr.ARPA> Date: Sat, 6-Sep-86 12:51:34 EDT Article-I.D.: utah-gr.8609061651.AA10239 Posted: Sat Sep 6 12:51:34 1986 Date-Received: Sat, 6-Sep-86 22:01:07 EDT References: <8609010732.6434@mulga.OZ> Sender: daemon@ucbvax.BERKELEY.EDU Reply-To: utah-gr!thomas (Spencer W. Thomas) Organization: University of Utah CS Dept Lines: 51 Approved: apollo@yale-comix.arpa Here are the commands that I have been using to create a "pop-up" menu. The menu is stored in ~mouse/menu, and contains lines of the form word: dm commands It causes the dm commands to be executed at the location the mouse button was originally pushed. The actions performed are: * On mouse down, grab the current cursor position, * pop up the menu window at that position, * the user then positions the cursor on the desired command and releases the mouse * grab the corresponding DM command * hide the menu * stuff the command into the cmd window and * execute it. Here is the code, grabbed from my key_defs file. It may need some quoting in spots, I'm not sure. There is some special casing for a 19L display (the (613,788) to get to the DM output window, in particular). I have commented this using # comments, you will want to delete them. on the mouse down: =; # echo current loc in DM output window (613,788); tr;dr; # move there \X:\;xc where; # grab all stuff at X: tdm; xp where; # stuff it into command window for editing ed;ed;ed; # delete X: es '('; # insert open paren for position spec /Y:/;ed;ed;ed; # find and delete Y: tr;es ')'; # stick close paren at end of posn dr; tl; xc where; # grab position string # insert command to pop mouse window es 'wi -i ~mouse/menu; wi -w ~mouse/menu;pt;tt;tl; dr;'; tr; es ';wm'; # and move it to cursor loc en # execute generated command On the mouse up: tl; /:/; # find the end of the menu label ar; dr; tr; xc menu; # grab the dm commands tl; # restore horizontal scroll wi -i ~mouse/menu; # hide the menu tdm; xp where; tr;es ';'; # insert positioning command into cmd window xp menu; tr; en # insert and execute menu command This is pretty slow, and if you "tickle" the mouse button, you get ahead of the DM and cause all sorts of trouble. If you are using a larger font (than f5x9), the command that the mouse down inserts will overflow the command window, and you will need to scroll the command window left at some point in the sequence. I finally gave up on using it. -- =Spencer ({ihnp4,decvax}!utah-cs!thomas, thomas@utah-cs.ARPA)