Help message Broadcasting system

Jim Bufalini jim at visitrieve.com
Thu Feb 11 18:45:27 EST 2010


Jacque wrote:

> Jeff Massung wrote:
> 
> > Instead, what about just having a background message loop processing
> that's
> > always checking the current focus target and displaying the help text
> for it
> > (if that option is enabled). For example:
> 
> <snip>
> 
> Good approach, that. I'd use a built-in message in the engine instead
> though, it's shorter.
> 
> In the stack script (or whatever script is in the hierarchy for all the
> relevant objects):
> 
> on mousemove x,y
>   put the helptext of the target into fld "help field"
> end mousemove
> 
> Then make a custom property called "helptext" for any object that needs
> to display it.
> 
> This handler will automatically empty the helptext field when
> appropriate, because if a custom property doesn't exist in an object,
> its value is returned as empty. One advantage to the above is that you
> don't need any loops or messaging. One disadvantage is that you have to
> remember to pass the mousemove message if any of the controls also use
> it, but that's minor.

I was just about to suggest what Jacque just suggested. ;-)

To piggyback on her suggestion... You may want to use a custom property set
of the main stack or even a separate text file, so that all your help
messages are in one place. And, if someday, you want to make your app
multilingual, having all of your help messages in one place to be translated
will be convenient. To do this requires a custom property set. So, instead
of: 

put the helpText of target into fld "helpField"

it would be :

put the helpText[target] of stack "<YourMainStackName>" into fld "helpField"

Jeff, one other suggestion. By putting the custom messaging the way you have
it in the openCard of every card, it is possible, if someone has say 20
cards the user has gone to, that you have 20 displayHelp messages looping
every second, just milliseconds apart, even when your app is idle. To avoid
this, you should always check the pendingMessages first before sending a
custom repeating message as in:

if "displayHelp" is not in the pendingMessages then
	send displayHelp to me in 1 second
end if

The other advantage of using Rev built-in messaging is that they may not
trigger when say the app is minimized of otherwise off-screen. Especially,
for example, if you use mouseEnter instead of mouseMove.

Aloha from Hawaii,

Jim Bufalini






More information about the Use-livecode mailing list