Help message Broadcasting system
Jeff Massung
massung at gmail.com
Thu Feb 11 16:51:01 EST 2010
On Thu, Feb 11, 2010 at 3:33 PM, Andrew Kluthe <andrew at rjdfarm.com> wrote:
>
> I am converting my noble little app into the glx framework, as I've
> realized
> that what it does will be invaluable to me in the long run.
>
> A feature that was requested a couple of days ago, and I assume needs to be
> developed early in the process, is for a Help system.
>
> For Example:
>
> 1.You click a field, lets say the field is for entering an insurance policy
> number.
>
> 2. A box that is always on the bottom of the card/stack displays
> information
> from a help Table in a db telling you the format of the purpose of this
> field. (i.e. what to put here, what it means, what format it needs to be
> in,
> etc.)
>
Andrew,
I don't know anything about GLX, but if I were you - since this "feature"
would likely permeate throughout your app - I'd do something that didn't
require you having to edit code in every single control of your app to
broadcast or otherwise change the help text.
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:
[[ -- begin source code -- ]]
local sTarget
on openCard
-- start the Help System message loop
send "displayHelp" to me in 1 second
end openCard
on displayHelp
get the focusedObject
-- don't continuously do the same work for the same control
if it is not sTarget then
put it into sTarget
-- TODO: update the contents of stack "Help"
-- if the stack is closed, but the option is enabled, open it now
if the mode of stack "Help" is 0 and gHelpEnabled then
modeless stack "Help"
end if
end if
-- continue the help message loop
send "displayHelp" to me in 1 second
end displayHelp
[[ -- end source code -- ]]
That way, you can just set data in each control that you want to display
help for and don't have to actually do any coding for any of them.
Jeff M.
More information about the use-livecode
mailing list