Single Common Group Across Multiple Stacks
Richard Gaskin
ambassador at fourthworld.com
Mon Jul 4 14:10:26 EDT 2016
Sannyasin Brahmanathaswami wrote:
> So, it's back to a behavior script that is external to the binary
> stacks a subject we discussed in depth earlier. *unless* one can
> refer to a behavior in another stack that is not part of the same
> stack file… I'm not sure how that will work… to be tested.
Yep. The only rule with behaviors is that the object containing the
behavior definition script needs to be in memory before any object
subscribing to it is loaded.
And even then, that's only if you want automatic resolution of the
behavior. If you load the behavior after the object that relies on it
you can still get it going with:
get the behavior of tSomeObj to the behavior of tSomeObj
..and that'll kick-start the resolution.
> 'automate copying of the group"
>
> That's an interesting option. I should try it.
>
> Ideally it would look like this in the preopenstack handler of
>
> [pseudo code]
>
> Stack A
> copy group "navigation" of stack "loader" to me
> repeat for each card x in this stack,
> place the group and set it's rect.
> end repeat
>
> I wonder about performance.
Personally, I'd do it just once during build time, or during development
whenever I modify the master copy.
But if you do find yourself with a need to dynamically create lots of
controls at once, I think you'll be quite pleasantly surprised by the
performance.
A while back I was experimenting with a construction/layout language I
was making in LC, loosely inspired by REBOL's VID:
<http://www.rebol.com/docs/view-guide.html>
The goal was to have the simplest writing that could automatically
produce meaningful layouts for certain types of apps that might lend
themselves to that sort of thing (for example, the sorts of test stacks
I make for unit tests).
If you lock messages and lock screen before you create stuff, LC can
whip up hundreds of objects in the blink of an eye.
Remember, everything in revToolbar is created on the fly from script
when LC launches. There's a lot of other stuff the IDE does during boot
so maybe a more impressive example is the DataGrid: when you set the
dgText or dgData it's building everything you see on screen in that moment.
For others reading this: the "to" clause of the "copy" command
specifying the destination as shown above is *very* useful for automated
object copying. Not only does it eliminate the need for a separate
"paste" command, but more importantly it doesn't affect the user's
clipboard, saving a tiny amount of time but more importantly leaves
whatever possibly-important data the user may have copied intact.
--
Richard Gaskin
Fourth World Systems
Software Design and Development for the Desktop, Mobile, and the Web
____________________________________________________________________
Ambassador at FourthWorld.com http://www.FourthWorld.com
More information about the use-livecode
mailing list