Hi,
The number of controls might require this in terms of speed (querying if the script contains is long) - the agent also uses a cached index to speed this up in the repeat loop though. I have also found that I use mostly templates and thus limit the repeat search to just groups so scripts are more dedicated or localized.
I handn't thought of looking in the script to see if a handler or function or whatever existed. Wow! That's so powerfull. Of course, I suppose someone *could* have already of used that name, so it might be better to prefix it with "MGM_" or something so that it is less likely to clash.
What are you worried about in terms of speed? If you said that the "doresize" (or whatever) was always near the start of the script then would this make a difference?
I do something similar to this in a Generic Arrow Resize Object I have created. The way I am trying to do it is to have an Initialization Handler in each control that sets a CustomProperty, in this case we could call it cpResizeHandler. The script would look something like this:
-- -- Called from openScipt or openCard -- on Initialize() put the number of controls into controlsmax repeat with x = 1 to controlsmax if "MGMInitianize" is in the script of control x then send "MGMInitialize" to control x end repeat end
-- -- The in the Script of each Control -- on MGMInitialize if the script of me contains "MGMDoResize" then set cpResizeHandler to "MGMDoResize" else set cpResizeHandler to "MGMDoResize" end if end
Then do the following in the resize stack command:
put this into your stack script... <this> on resizeStack MagicGM pass resizestack -- if you dont pass, the RevErrorDialog (RED) or other stacks might not resize correctly although the RED still doesnt yet... end resizeStack
on MagicGM put the number of controls into controlsmax repeat with x = 1 to controlsmax
if the cpResizeHandler of control x is not empty then
send the cpResizeHandler of control x
end ifend repeat end MagicGM </this ;>
(((***Question? What are <text> and </this ;> lines?***)))
This shoud speed it up at the expense of adding time to the openStack or openCard command. The advantage is that you don't have to change the Stack/Card Script you add a new control.
One question though. If the control does not contain an MGMInitialize handler, the Custom Property, cpResizeHandler will not exist. Do I need a seperate test for his as in:
if exists cpResizeHandler of control x then
if the cpResizeHandler of control x is not empty then
send the cpResizeHandler of control x
end if
end ifAny suggestions/comments greatly appreciated.
All the Best Dave
_______________________________________________ use-revolution mailing list [email protected] http://lists.runrev.com/mailman/listinfo/use-revolution
