Popup menu bug?
J. Landman Gay
jacque at hyperactivesw.com
Tue Jun 2 22:31:16 EDT 2009
Josep wrote:
> Hello Jaqueline,
>
> Local at stack level? Where I must define it? I don't see...
A script local variable is like a global variable but it only applies to
a single script. If you declare a script local at the top of the script,
any handler in the same script can use it. Handlers in other scripts
can't see it.
If your Search button has its own script and your option button has a
different script, then you can't use a script local variable. You'd need
a global. But if both buttons call handlers located in the stack, for
example, then both stack handlers can use a script local variable that
is located in the stack script.
To declare a script local variable, you just declare it at the top of
the script, before any other handlers -- or at least before any handlers
that use it. Most people put them at the top. This is the same place
constants go.
For a script local that stores the option menu choice, you can do
something like this:
local sMenuChoice -- this goes at the top of the script
on markOption pMenuChoice -- option_button calls this
put pMenuChoice into sMenuChoice -- store it in the script local
-- set checkmark here if you want
end markOption
on search -- search button calls this
put sMenuChoice into tSearchTerm
-- etc
end search
--
Jacqueline Landman Gay | jacque at hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
More information about the use-livecode
mailing list