Instantiaing Grouped Controls - Templates - Responsive

Richard Gaskin ambassador at fourthworld.com
Thu Jun 8 19:40:24 EDT 2017


Alex Tweedly wrote:

 > On 08/06/2017 22:37, Richard Gaskin via use-livecode wrote:
 >> Alex Tweedly wrote:
 >>
 >> > On 08/06/2017 20:20, Richard Gaskin wrote:
 >> >> If you're committed to a script-only stack there's no decision to
 >> >> make: every control must be instantiated dynamically, because a
 >> >> script-only stack contains the stack script only, no objects.
 >> >>
 >> > Well, not quite "every control".
 >> >
 >> > You could :
 >> >   - if the relevant template control/group exists - copy it
 >> >   - if not, create it dynamically, and then copy it
 >> >
 >> > This way
 >> >   - the stack can be script-only
 >> >   - most instantiations take minimal time
 >>
 >> True, to the degree that your app uses non-script-only stacks, you
 >> won't need to do everything in script only. :)
 >>
 >>
 > No, I'm actually doing this all within a script-only stack.
 > It's a behaviour stack, which is used as a behaviour attached to
 > groups in the main app stack (which could be binary or script-only).
 > The behaviour is defined to create controls (actually, groups) as
 > requested by the main stack - which basically sets up a list of needed
 > controls, and then calls a handler in the behaviour.
 >
 > So something vaguely like ....
 >
 > on preOpenCard
 >
 >    settheEditingMode ofgrp"grp1"ofmetoFALSE
 >
 > settheSpec ofgrp"grp1"ofmetogSpec
 >
 > dispatch"buildGroup"togrp"grp1"
 >
 > ...
 >
 > and within 'buildgroup' it does the
 >   check for the template group existing, create it (from an internal
 > default set of properties) if needed
 >
 > This also (I think) allows for the app stack to pre-define the
 > template groups ahead of time, thereby pre-empting the creation of the
 > groups within the behaviour stack. Haven't actually done that yet, or
 > fully considered the problems doing so will create - but it's a
 > loophole I'm leaving myself in case I need it :-)


I don't understand.  A script-only stack contain no objects, so even if 
you later copy them, they still need to be dynamically instantiated at 
some point, no?

Like a Zen koan: how can there be a binary object where there is no 
binary object?

-- 
  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