on mouseEnter

zryip theSlug zryip.theslug at gmail.com
Fri Apr 9 13:28:59 CDT 2010


2010/4/9 Andrew Kluthe <andrew at rjdfarm.com>:
>
> Currently, I have a stack that attaches to whatever window is open and
> provide help information for my application.
>
> In each object that I wanted help information for is a on mouseEnter handler
> that changes the text of the help information stack.
>
> I was thinking a better way to do this might be to handle/override the
> mouseEnter handler for the whole stack?
>
> something like this:
>
> on mouseEnter
> set the helpInfo of stack "Help" to the helpText of the target
> end mouseEnter
>
> Could I handle or override the mouseEnter in the stack or card script to
> pull the helpText of whatever control the mouse is over?
>
> Or should I stick with what I have?

Hi Andrew,

Effectively you can place the mouseEnter handler in the card or the
stack script instead of each object script you want to document.

Events in Runrev follows the object hierarchy presented in this
excellent article from Richard Gaskin:

http://www.fourthworld.com/embassy/articles/revolution_message_path.html

-> If you want that an object display the help message, remove the
mouseEnter from its script. In this case, the mouseEnter will be
intercepted by the next object in the hierarchy (the group -> the card
-> the bg -> the substack -> the stack, in this order)
In your case, place the mouseEnter handler in your card or stack.

-> If you want that a special object performs an action on mouseEnter,
then displays its help message, use the pass command in your control,
like this:

on mouseEnter
    doSomethingWithTheCtrl
    pass mouseEnter -- pass the mouseEnter to the next object in the hierarchy
end mouseEnter

-> If you want that your mouseEnter handler follows all the hierarchy
place a mouseEnter event in each level of the hierarchy, with the pass
mouseEnter command.

-> You can also pass the handler directly to an object without follow
the hierarchy. For this, use the send, dispatch or call commands (this
commands was recently discussed in this thread
http://www.mail-archive.com/use-revolution@lists.runrev.com/msg131598.html),
like this:

on mouseEnter
    send "mouseEnter" to anotherObject
end mouseEnter

-> At last you can stop the event with the exit command:

on mouseEnter
    if (the helpText of the target is empty) then exit mouseEnter
    displayHelpMessage the helpText of the target
    pass mouseEnter
end mouseEnter

HTH,

-- 
-Zryip TheSlug- wish you the best! 8)
http://www.aslugontheroad.co.cc



More information about the use-livecode mailing list