To add to this, and maybe this is not relevant, you can also pass
parameters by reference, using '@'
on handler1
put "someText" into someVariable
handler2 someVariable
put someVariable
end handler1
on handler2 @someVariable
delete char 1 of someVariable
end handler2
if you run this, you will see "omeText" in the message box.
This may not what be you want, but can be useful when working with
variables containing a lot of data, since the data itself is not
passed (ie. copied) from handler1 to handler2, which might have
performance implications where big data is concerned.
Best,
Mark
On 10 Oct 2006, at 01:12, Mark Schonewille wrote:
Robert,
If you need a variable to be available to all handlers in an object
(button, field, card, stack, group) you can do the following:
local lVar
on handler1
put x into lVar
handler2
and handler1
on handler2
put lVar
-- message box contains x
end handler 2
but if you need the variable only in handler1 and handler2 and not
in any other handler of the script of that particular object, you
can do
on handler1
put x into myVar
handler2 myVar
end handler1
on handler2 theVar
put theVar
-- msg box contains x
end handler2
If you want a variable to be available to all scripts in the IDE or
standalone, replace
local lVar
with
global gVar
and use the following:
global gVar
on handler1
put x into gVar
handler2
and handler1
on handler2
put gVar
-- message box contains x
end handler 2
Hth,
Mark
--
Economy-x-Talk
Consultancy and Software Engineering
http://economy-x-talk.com
http://www.salery.biz
Get your store on-line within minutes with Salery Web Store
software. Download at http://www.salery.biz
Op 7-okt-2006, om 6:18 heeft Robert Sneidar het volgende geschreven:
Am I correct in stating that variables in a custom command are not
visible to other commands and functions that it calls? In other
words, if I put "blah" into bobtest in handler "dosomething" and
then "dosomething" calls handler "somethingelse", is bobtest
invisible to handler "somethingelse"? Is there any way to change
this behavior? If not, is there any way I can lobby Runtime
Revolution to consider adding this as a switchable option? OMHO
children should inherit what the parent has. I see variables
defined by a parent as objects belonging to the parent, and
therefore should be visible to the parent.
Then the local declaration would have some meaning. Declaring a
variable as local would force the behavior that is status quo now.
Otherwise parent variables would be visible to the handlers the
parent calls. This seems to make more sense to me. But I suspect
this would be a huge recoding change.
I think I could mimic this behavior, but at a big performance
penalty. I think my Foxpro port hangs on this.
Bob Sneidar
IT Manager
Logos Management
Calvary Chapel CM
_______________________________________________
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your
subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
_______________________________________________
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution