Popup Menu - Show on mouse over
janschenkel at yahoo.com
Thu Oct 17 05:42:00 EDT 2002
Recently, Simon Forster asked:
> On Tuesday, October 15, 2002, at 12:31 PM, Jan
> Schenkel wrote:
> > on mouseEnter
> > popup me
> > end mouseEnter
> Many thanks. Next series of questions if I may:
> - How do I "hide" the popup on mouseLeave?
As Sarah already answered your other questions, I'll
focus on your first question.
It seems the 'popup' command suppresses any and all
messages until a selection is made or the escape
button is pressed or the user clicks elsewhere.
Rather inconvenient, as you can't hie it on
mouseLeave. I remembered under HyperCard 1.2.5 one
could emulate menus, without an XFCN.
The trick? Show a field and handle all the appropriate
messages so that things are selected. Here's the
recipe for your own popup show/hide routine.
- Make a new field "myPopUpField" and put the lines of
your popup-menu in there.
- Resize it so everything fits snuggly.
- In the properties window, make sure the field has a
fixed line height, and fill it in (e.g. 12).
- Also make sure it has list-field behaviour.
- Now set its script to:
on mouseMove pX, pY
put the textHeight of me into tHeight
put pY - (the top of me) + (item 1 of the \
margins of me) into tY
put (tY DIV tHeight) into tLine
if tLine = 0 then put 1 into tLine
do ("set the hilitedLines of me to" && quote & \
tLine & quote)
-- check the hilitedLines prop and do things
-- hide the field after you're done handling it
- To make it all work, set the script of the button
where you want the user to mouse over, to:
show field "myPopUpField"
if the mouseLoc is not within the rect of field \
"myPopUpField" then hide field "myPopUpField"
It's an old trick revamped for RunRev ; but it's a
great workaround for the popup command.
Hope this helped,
"As we grow older, we grow both wiser and more foolish at the same time." (La Rochefoucauld)
Do you Yahoo!?
Faith Hill - Exclusive Performances, Videos & More
More information about the Use-livecode