sho@tybalt.caltech.edu (Sho Kuwamoto) (06/27/88)
Is there *any* way I can get a button to detect a mouseEnter, a mouseWithin, and mouseLeave when the user has the button held down? Here's the background. I am writing some documentation for a program in Hypercard. It starts off in a mock up of the running program. The user can click on various portions of the card to get info. If he wants info on a particular tool, he clicks on the right tool in the palette. Etc. Well, I thought it would be nice to let the user pull down appropriate looking menus to get help on each particular menu item. I don't have a copy of the PopUpMenu XCMD, and would appreciate any pointers... In either case, I'm not sure it will solve all of my problems for the following reasons: 1) I have a non-standard "Tools" menu. 2) I'm hosed if this XCMD will not exit until the user releases the mouse. What I decided to do was to simulate apple's menus using Hypercard. (This part is long, bail now if you want) I have done the following: 1) Drawn in the menubar and put buttons on all of the choices 2) For each menu, I've made a new card showing the menu already pulled down, and put buttons on all the choices. 3) Wrote a script that tracks the mouse and goes to the right card, or hilights the correct menu item. The hilighting was easy thanks to the hilite property of buttons. The only problem is with speed. To find the correct menuitem to hilite, I do the following: repeat with x = 1 to the number of buttons put the rect of button x into r if (h >= (item 1 of r)) and (h <= (item 3 of r)) and (v >= (item 2 of r)) and (v <= (item 4 of r)) then set the hilite of button x to true else set the hilite of button x to false end if end repeat Where h and v already have the mouseH and the mouseV. It works, but is really slow. The items on the menubar itself are declared as bkgnd buttons, and I have to do a similar thing with them when the mouse strays to a menu title (what should I call those things anyways!) What would be ideal is if I could somehow coerce the system into giving me mouseEnter messaages while the button is held down. Sending a mouseUp to the original object didn't seem to help, and after further experimentation, I found that it didn't work even if no button or field was clicked on to begin with. At this point, it seems like the easiest thing to do would be to write my own menubar XCMD. What a pain. If there *is* some way to get mouseEnter messages even when the mouse is down, I'd love to hear. I don't have a copy of the APDA developer's stuff, and I've heard there are a lot of otherwise undocumented commands.... -Sho (sho@tybalt.caltech.edu, sho@caltech.bitnet, ...!cit-vax!tybalt!sho)
ns@cat.cmu.edu (Nicholas Spies) (06/28/88)
Much easier, and not involving XCMDs, is to write a a doMenu handler that provids usual menu behavior when a "help" checkbox button is clear and provides help "answer" dialogs when checked. Such as... on doMenu choice if choice is "Button Info... then if the hilite of bg button "help" then answer "Opens info box for selected button." with "OK" else pass doMenu choice end if else if ... ...and so forth. -- Nicholas Spies ns@cat.cmu.edu.arpa Center for Design of Educational Computing Carnegie Mellon University