We are in need of an "info-text" control which we can use "everywhere" instead 
of reinventing this in each stack/ module in our app.  for Help | About 
|Instructions |Privacy Policy etc…  all to be dynamically loaded and shown on 

Different contexts require a different size.

Thanks to Richard's gentle prodding and logic I dove enthusiastically into the 
learning curve on responsive UI code for LC.. using the Sheep Herder lesson

Our use case is also very simple.  A control for displaying info/text

4 objects:

1) background image (wont' suffer visually from distortion)
2) bkgnd "mask" graphic (goes underneath a field)
3) info-text field
4) widget with SVG close "X out"path, top right..

I put this script in the group "info-display"… it works just fine. Yay! mission 
accomplished for a) responsive control

on resizeControl
lock screen
set the rect of img "info-bkgnd-img" to the rect of me
set the width of grc "info-field-bkgnd" to the width of me * .87
set the height of grc "info-field-bkgnd" to the height of me * .87
set the width of fld "info-text" to the width of me * .80
set the height of fld "info-text" to the height of me * .80
set the loc of img "info-bkgnd-img" to the loc of me
set the loc of grc "info-field-bkgnd" to the loc of me
set the loc of fld "info-text" to the loc of me
set the right of widget "close-info" to the right of fld "info-text"
set the bottom of widget "close-info" to the top of grc "info-field-bkgnd" - 5
set the loc of me to the loc of this card
unlock screen
end resizeControl

So far, I'm sure this is baby talk for most of you.

But the next question is

b)  about best strategy for instantiation.

1) does it make sense to build this dynamically as needed from script using 
"create" and then you put this "create control" script into a library? It has 
the advantage of no binary object, so you can keep it in your text only 
"stacks" .livecodescript, but could be slow?


2) is it faster (on Android or iOS especially)  to create it as a template 
group  then use

copy grp "info-display"  of card 1 of stack "dialog-templates" to this card


What has your experience led you to choose as your best practice and why and 
how do you do it?

Similarly we have small "lists" Indices… that are typically rows of grouped 
controls. Using data grid would be overkill in most contexts… so the default is 
to create a "row" as a group, duplicate this and then group all those rows as a 
single scrolling group.
so this is a similar pattern: use a template and copy the group? or instantiate 
them dynamically from script? Which is better/faster? IYHO


use-livecode mailing list
Please visit this url to subscribe, unsubscribe and manage your subscription 

Reply via email to