Re: Line length

2020-10-26 Thread Dan Friedman via use-livecode
Bob,

I do what you're talking about all the time.   Here's my setObjectHeightToText 
command that I use (pass it the long id of the field, and the minimum height 
you want):

on setObjectHeightToText lID,minH
  put the rect of lID into tRect
  put item 2 of tRect + the formattedHeight of lID into item 4 of tRect
  if minH > 1 then
if item 4 of tRect - item 2 of tRect < minH then
  put item 2 of tRect + minH into item 4 of tRect
end if
  end if
  set the rect of lID to tRect
end setObjectHeightToText

Hope that helps!

-Dan
 

On 10/26/20, 10:18 AM, "use-livecode on behalf of Bob Sneidar via 
use-livecode"  wrote:

I have a field on one of my apps whose width needs to change depending on 
content, but there is a minimum and a maximum width aspect, so that an empty 
field doesn’t appear like a weird tiny rectangle or stretch to overlap other 
objects. 

I use something like:

if the formattedWidth of field x < tMinWidth then set the width of field x 
to tMinWidth
else if the formattedWidth of field x > tMaxWidth then set the width of 
field x to tMaxWidth
else set the width of field x to the formattedWidth of field x

Bob S


> On Oct 24, 2020, at 3:35 AM, Klaus major-k via use-livecode 
 wrote:
> 
> Hi Richmond,
> 
>> Am 24.10.2020 um 12:17 schrieb Richmond via use-livecode 
:
>> 
>> Over in the Forums someone has asked a question about measuring the 
length of text lines.
>> Of course one can count characters, but in most alphabetic systems 
different characters have different lengths.
>> Is there a way to measure the length as in LENGTH of a line rather than 
count the number of characters it
>> contains?
> 
> ...
> put the formattedwidth of line 1 of fld 1
> ...
> 
>> Richmond.
> 
> Best
> 
> Klaus
> 
> --
> Klaus Major
> https://www.major-k.de
> kl...@major-k.de
> 
> 
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your 
subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your 
subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Line length

2020-10-26 Thread Bob Sneidar via use-livecode
I have a field on one of my apps whose width needs to change depending on 
content, but there is a minimum and a maximum width aspect, so that an empty 
field doesn’t appear like a weird tiny rectangle or stretch to overlap other 
objects. 

I use something like:

if the formattedWidth of field x < tMinWidth then set the width of field x to 
tMinWidth
else if the formattedWidth of field x > tMaxWidth then set the width of field x 
to tMaxWidth
else set the width of field x to the formattedWidth of field x

Bob S


> On Oct 24, 2020, at 3:35 AM, Klaus major-k via use-livecode 
>  wrote:
> 
> Hi Richmond,
> 
>> Am 24.10.2020 um 12:17 schrieb Richmond via use-livecode 
>> :
>> 
>> Over in the Forums someone has asked a question about measuring the length 
>> of text lines.
>> Of course one can count characters, but in most alphabetic systems different 
>> characters have different lengths.
>> Is there a way to measure the length as in LENGTH of a line rather than 
>> count the number of characters it
>> contains?
> 
> ...
> put the formattedwidth of line 1 of fld 1
> ...
> 
>> Richmond.
> 
> Best
> 
> Klaus
> 
> --
> Klaus Major
> https://www.major-k.de
> kl...@major-k.de
> 
> 
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Line length

2020-10-26 Thread Devin Asay via use-livecode
There is also a measureText() function that might help.

Devin

> On Oct 24, 2020, at 4:35 AM, Klaus major-k via use-livecode 
>  wrote:
> 
> Hi Richmond,
> 
>> Am 24.10.2020 um 12:17 schrieb Richmond via use-livecode 
>> :
>> 
>> Over in the Forums someone has asked a question about measuring the length 
>> of text lines.
>> Of course one can count characters, but in most alphabetic systems different 
>> characters have different lengths.
>> Is there a way to measure the length as in LENGTH of a line rather than 
>> count the number of characters it
>> contains?
> 
> ...
> put the formattedwidth of line 1 of fld 1
> ...
> 
>> Richmond.
> 
> Best
> 
> Klaus
> 
> --
> Klaus Major
> https://www.major-k.de
> kl...@major-k.de
> 
> 
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

Devin Asay
Director
Office of Digital Humanities
Brigham Young University


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Line length

2020-10-24 Thread Klaus major-k via use-livecode
Hi Richmond,

> Am 24.10.2020 um 12:17 schrieb Richmond via use-livecode 
> :
> 
> Over in the Forums someone has asked a question about measuring the length of 
> text lines.
> Of course one can count characters, but in most alphabetic systems different 
> characters have different lengths.
> Is there a way to measure the length as in LENGTH of a line rather than count 
> the number of characters it
> contains?

...
put the formattedwidth of line 1 of fld 1
...

> Richmond.

Best

Klaus

--
Klaus Major
https://www.major-k.de
kl...@major-k.de


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Line length

2020-10-24 Thread Richmond via use-livecode
Over in the Forums someone has asked a question about measuring the 
length of text lines.


Of course one can count characters, but in most alphabetic systems 
different characters have different lengths.


Is there a way to measure the length as in LENGTH of a line rather than 
count the number of characters it

contains?

Richmond.

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode