gwalias-rev at yahoo.com
Sun Dec 12 14:16:02 CST 2004
OK, thanks to the help of Rob and others, I have a
"setGlobal" function that works
Here it is:
on setGlobal tname, tvalue
set the tname of button "Button" of stack
"EZGlobals" to tvalue
- When I hit a button on the calling stack, it creates
custom properties just fine in the button on my
But when I ty to poll the values of these custom
properties (which I can see in the inspector), they
are empty but I get no error.
Here's the retrieving function in the library stack
function getGlobal tname
return the customProperties[tname] of button
"Button" of stack "EZGlobals"
So for example, I set a global called "myVar" to 144.
I can see it in the custom properties of the button on
my library stack. When I do "answer
getGlobal("myVar")" either from the calling stack or
the message box, it works without an error but I get
an empty value.
--- Rob Cozens <rcozens at pon.net> wrote:
> >Could you elaborate on the "gotcha" thing. I
> >my function from
> > "function setGlobal <params>"
> > "on setGlobal <params>"
> >and now I don't get the error message, but instead
> >setting the cutom property "myVar" of the button to
> >23.6, it creates a cutom property called
> >What's the difference between a command and a
> >function- I even tried setting "setGlobal" back to
> >function and returning something, but then I got
> >old "handler not found" error again. I am confused
> >about commands and functions - why are my functions
> >not seen and which should I use and when?
> A command starts with "on"; a function starts with
> When calling a function, the arguments to be passed
> are enclosed in
> parens (); when calling a command they are
> not--though individual
> arguments may contain ()..
> A function must return a value; a command may return
> a value.
> The Rev script parser looks for the "(" in a handler
> call to
> determine whether it is a function or command. If
> it sees "setGlobal
> params" it generates a "command message"; if it sees
> "setGlobal(params)" it generates a "function
> So if one had a command "setGlobals" and scripted
> "setGlobals (the
> short name of the target)", one would get a "handler
> not found"
> [expecting a function]; whereas scripting.
> "get the short name of the target
> setGlobals it"
> will work.
> >Here are the "setGlobal" and getGlobal functions
> >on setGlobal tname, tvalue
> > set the tname of button "Button" of stack
> >"EZGlobals" to tvalue
> >end setGlobal
> >function getGlobal tname
> > return the tname of button "Button" of stack
> >end getGlobal
> I don't see any obvious error. How are tname &
> tvalue set before the
> setGlobal command is called.
> use-revolution mailing list
> use-revolution at lists.runrev.com
:::::::::: Gordon Webster ::::::::::
More information about the use-livecode