Laying out text

Paul Hibbert paul at livecode.org
Sun Feb 22 15:35:48 EST 2015


Terence,

You should be able to do this with measureText, check the dictionary for the details. You'll probably just need a repeat loop with a function something like…

function fieldLength pText
  put measureText(pText,fld "myDefaultField") into fLength
  return fLength
end fieldLength

…then work through your data and add up the lengths (+ margins) to give the answer you are looking for.

HTH

Paul

> On Feb 22, 2015, at 12:32 AM, Terence Heaford <t.heaford at icloud.com> wrote:
> 
> I have a variable amount of fields (approx. 20) to layout in a table like format on screen. These form the legend of a chart.
> 
> The number of fields in the width and height depends on the size of the card which is variable as the users adjust the window size.
> 
> Is it possible in LC to work out the size (width) of the field required to hold the text without firstly creating the field or is it necessary to place all the fields on the screen, work out the formattedWidth and then layout the fields accordingly?
> 
> 
> Thanks
> 
> Terry
> 
> 
> 
> 
> 
> 
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list