ortiz-luis@YALE.ARPA ("Luis F. Ortiz") (09/02/86)
Does anyone know how to implement a pop up menu for an apollo, which would be somewhat similar to that of a sun ? Ideally, I would like to be able to define a mouse button (for a particular pad) to bring up a small window in which I am running dialog. The way I tried to do this is by keeping the window dialog is running in invisible and defining the second button on the mouse button to make the window visible. However, I would like the menu to appear underneath the new mouse position but there is no way to move an invisible window (?) which means the user first sees the menu appear in the old position and then reappear under the cursor. Mac-like pull-downs are probably just as tricky since the interaction with dialog is restricted to the size of the related pad. It seems to me 1. I am stuck with allocating a portion of my window for dialog and having it visible all the time (not that bad really - but annoying) 2. more DM commands should probably be allowed to reference windows by name Thanks. ** End Forwarded Message **
thomas%utah-gr@UTAH-CS.ARPA (Spencer W. Thomas) (09/06/86)
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)