Page 1 of 1

formattedwidth seems ignore return char in btn label: fixed

Posted: Fri Sep 15, 2017 6:07 pm
by jmburnod
Hi All
First time I use a btn label with two lines.
It seems that the formattedwidth ignore return char
(LC 8.1.6 for OSX)
Best regards
Jean-Marc

Re: formattedwidth seems ignore return char in btn label

Posted: Sat Sep 16, 2017 12:34 am
by dunbarx
Jean-Marc

With a default button in v.6.7:

Code: Select all

on mouseUp
   put "AAAAAAAAAAAAAA" & return & "BBBB" into temp
   set the label of btn 1 to temp
   
   answer the formattedWidth of btn 1
end mouseUp
I get 143. That is what it would take to fit those "A's"

Craig

Re: formattedwidth seems ignore return char in btn label

Posted: Sat Sep 16, 2017 8:20 am
by jmburnod
Hi Craig,
I get 163 (LC 8.1.6)
Same result with return or not in btn label
Jean-Marc

Re: formattedwidth seems ignore return char in btn label

Posted: Sat Sep 16, 2017 10:06 am
by Thierry
jmburnod wrote: Same result with return or not in btn label
Jean-Marc,

Some tests on my MacSierra, LC 8.1.6

Code: Select all

on mouseUp
   get "M"
   set the label of me to IT
   put the formattedWidth of me into v1
   
   get "M" &cr
   set the label of me to IT
   put the formattedWidth of me into v2
   
   get "M" &cr& "M"
   set the label of me to IT
   put the formattedWidth of me into v3
   
   get "M" &cr& "MMMMMMMM"
   set the label of me to IT
   put the formattedWidth of me into v4
   
   put v1 && v2 && v3  && v4 --> 16 22 39 157
   
end mouseUp

but I don't know what to say about the results :shock:

Bon week-end,

Thierry

Re: formattedwidth seems ignore return char in btn label

Posted: Sat Sep 16, 2017 1:26 pm
by jmburnod
Hi Friends,
Thank you.
I'll fill a bug report
Best
Jean-Marc

Re: formattedwidth seems ignore return char in btn label

Posted: Sat Sep 16, 2017 3:46 pm
by dunbarx
Does it mean anything at all that the formattedWidth of a button with a certain text in its label is different than the formattedWidth of a field with the same text? I assume that is just how such text is displayed in the two controls.

Craig

Re: formattedwidth seems ignore return char in btn label

Posted: Sat Sep 16, 2017 4:50 pm
by jmburnod
the formattedWidth of a button with a certain text in its label is different than the formattedWidth of a field with the same text?
Yes, that is the case on LC 8.1.6
Jean-Marc

Re: formattedwidth seems ignore return char in btn label

Posted: Sun Sep 17, 2017 10:35 pm
by bwmilby
Put together a test stack to check this out on a variety of LiveCode versions. Every one I tested on Mac exhibited the error. 9.0DP8 on Windows that gave the "expected" results.

Code: Select all

   put "M" into tLabel
   set the label of me to tLabel
   set the label of me to tLabel & tLabel
   set the label of me to tLabel & tLabel & tLabel
   set the label of me to tLabel & cr
   set the label of me to tLabel & cr & tLabel
   set the label of me to tLabel & cr & tLabel & tLabel

   put space & the formattedWidth of me after field "Results" --after each "set" line above
Mac tests on Sierra, Win tests on Windows 10
6.7.11 & 7.1.4 Mac --> 17 26 35 20 29 38
6.7.11 & 7.1.4 Win --> 19 30 41 27 38 49

8.1.7RC1 Mac --> 19 30 41 22 34 45
8.1.7RC1 Win --> 19 30 41 27 38 49

9.0DP8 Mac --> 19 30 41 22 34 45
9.0DP8 Win --> 19 30 41 19 19 30

Re: formattedwidth seems ignore return char in btn label

Posted: Thu Sep 21, 2017 4:50 pm
by jmburnod
Hi All,
bug confirmed 20405
Best
Jean-Marc

Re: formattedwidth seems ignore return char in btn label: fixed

Posted: Mon Nov 13, 2017 3:56 pm
by jmburnod
Hi All,
Comment # 4 on bug 20405 from Panos Merakos
This bug is now fixed in LiveCode 8.1.8 RC-1
Best regards
Jean-Marc