Instantiaing Grouped Controls - Templates - Responsive

Richard Gaskin ambassador at fourthworld.com
Thu Jun 8 17:37:48 EDT 2017


Alex Tweedly wrote:

 > On 08/06/2017 20:20, Richard Gaskin via use-livecode 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. :)

Even simpler, as long as you're mixing binary and script-only stacks, 
just use binary stacks for the UI driven by behaviors defined in 
script-only stacks.

That's how I do most of my stuff these days.  I think of the UI stacks 
as somewhat akin to NeXT/Apple NIB files, with most of the code separate 
from them.

This lets me keep code where code is most productive (plain text), and 
lets me keep UI where UI is most productive (building the visual 
elements visually in the IDE).

I don't work in production teams large enough to require multiple 
developers crafting UIs in the same window at the same time, so keeping 
UI in binary stacks has worked well for me.  YMMV.


 >> Which reminds me: before I run off an spend an afternoon writing one,
 >> has anyone here written a tool that reads a stack laid out with
 >> objects and produces the script needed to recreate it from a
 >> script-only stack?
 >
 > Haven't done it - but I really should have done by now :-)

Please consider it. I could get it done, but it would be a long script. 
If you write it it'll be a three-liner done with some clever use of 
arrays. :)

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