Instantiaing Grouped Controls - Templates - Responsive

Sannyasin Brahmanathaswami brahma at hindu.org
Mon Jun 12 02:59:21 EDT 2017


OK well, continued working on this

first: the resizeControl thing did not work out at all because it depends on the user resizing the stack.

using that same handler but with "send" breaks everything because if you set the rect of the main enclosing object then the rect of the group "me" start to change because the child objects are our side, so sending a 4 values as a rect to the group with the "resizeControl" with reference to "me" starte production very odd results.

So it seems more "rock solid" and less "snakey" just to use the largest enclosing object at the bottom of the group as the reference coords. After that it's simple math and no caveats because you are establishing a "coordinate system" from the group with one object and reference everything from there, Suddenly it became very easy:

on updateMyRect pRect
   lock screen
   put the long ID of img "info-bkgnd-img" into tFrame
   set the rect of img "info-bkgnd-img" to pRect
   set the width of grc "info-field-bkgnd" to (the width of tFrame) * .87
   set the height of grc "info-field-bkgnd" to (the height of tFrame) * .87
   set the width of fld "info-text" to (the width of tFrame) * .80
   set the height of fld "info-text" to (the height of tFrame)  * .80
   set the loc of grc "info-field-bkgnd" to the loc of tFrame
   set the loc of  fld "info-text"  to the loc of tFrame
   set the right of widget "close-info" to (the right of grc "info-field-bkgnd" - 4)
   set the top   of widget "close-info" to the top of grc "info-field-bkgnd" + 10
   unlock screen
end updateMyRect


As for instantiation. We *do* use binary stacks as "views" so… just as we use a card to hold icons for buttons, that the user never sees.. so why not keep group controls in a stack and copy them… reserve the "dynamic creation from script" for a use case where this is your only option. or you *really* need to collaborate and want that all as text for GIT.

so, then the last question is… where do you store the grouped controls… I guess you need a lib_template.livecode or something like that…. as long as it is in the stack files you will end up opening it as soon as you all it, the copy your assets out as needed ot the "current" GUI that needs them.  


still fishing… but getting there…

 

On 6/8/17, 9:20 AM, "use-livecode on behalf of Richard Gaskin via use-livecode" <use-livecode-bounces at lists.runrev.com on behalf of use-livecode at lists.runrev.com> wrote:

    If I don't need to create an object I probably won't, adjusting an 
    existing object instead.  It only saves one step, but its a savings just 
    the same.



More information about the use-livecode mailing list