Using Behaviors for Triggering UI Design - Run Time

Sannyasin Brahmanathaswami brahma at hindu.org
Wed Mar 30 00:50:30 EDT 2016


 
This goes to the architecture discussion, but more to implemetation best practices/methods, and not organization.

Let's say we have a series of fields that have just a few words of text in them we want to center vertically. Text varies. Our designers may want to change the words over time.  I don't want to have to go in and manually adjust the top and bottom margins to achieve the position.

So then this is were dynamic runtime GUI layout/typesetting may be the way to go. Once the UI is all finished one could turn it off because the properties would be set for the fields.

We could create a behavior (ideally an external.livecodescript text file) with this in it  

command centerTextVertically
put the formattedheight of me into tTotalTextHeight
put ( the height of me - tTotalTextHeight ) / 2 into tTopBottomMargins
set topmargin of me to tTopBottomMargins
end centerTextVertically

put the long ID of the button that contains that into the field; then make multiple copies of that field place them on the UI.

1)  When, how and what is the most efficient way...to trigger this?  in a preopenstack or preopencard handler? so that the UI fields are all centered when the card renders?  

But then it needs to be a behavior of the stack or card, but then the reference to "me" fails to target the fields which all have the same name.

2) Still waiting on how to set a behavior to an external.livecodescript. Dictionary only descripts the long id of a button method.

BR





More information about the use-livecode mailing list