formattedwidth seems ignore return char in btn label: fixed

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

Post Reply
jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1985
Joined: Sat Dec 22, 2007 5:35 pm
Location: Genève
Contact:

formattedwidth seems ignore return char in btn label: fixed

Post by jmburnod » Fri Sep 15, 2017 6:07 pm

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
Last edited by jmburnod on Mon Nov 13, 2017 3:57 pm, edited 1 time in total.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4919
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: formattedwidth seems ignore return char in btn label

Post by dunbarx » Sat Sep 16, 2017 12:34 am

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

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1985
Joined: Sat Dec 22, 2007 5:35 pm
Location: Genève
Contact:

Re: formattedwidth seems ignore return char in btn label

Post by jmburnod » Sat Sep 16, 2017 8:20 am

Hi Craig,
I get 163 (LC 8.1.6)
Same result with return or not in btn label
Jean-Marc

Thierry
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 580
Joined: Wed Nov 22, 2006 3:42 pm
Location: France
Contact:

Re: formattedwidth seems ignore return char in btn label

Post by Thierry » Sat Sep 16, 2017 10:06 am

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
Thierry Douez - https://sunny-tdz.com
Pourquoi tant de notes lorsqu'il suffit de jouer les plus belles... [Barbara]

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1985
Joined: Sat Dec 22, 2007 5:35 pm
Location: Genève
Contact:

Re: formattedwidth seems ignore return char in btn label

Post by jmburnod » Sat Sep 16, 2017 1:26 pm

Hi Friends,
Thank you.
I'll fill a bug report
Best
Jean-Marc

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4919
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: formattedwidth seems ignore return char in btn label

Post by dunbarx » Sat Sep 16, 2017 3:46 pm

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
Last edited by dunbarx on Sat Sep 16, 2017 7:15 pm, edited 1 time in total.

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1985
Joined: Sat Dec 22, 2007 5:35 pm
Location: Genève
Contact:

Re: formattedwidth seems ignore return char in btn label

Post by jmburnod » Sat Sep 16, 2017 4:50 pm

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

bwmilby
Posts: 33
Joined: Wed Jun 07, 2017 5:37 am
Contact:

Re: formattedwidth seems ignore return char in btn label

Post by bwmilby » Sun Sep 17, 2017 10:35 pm

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
Attachments
FormattedWidthTest55.livecode.zip
Test Stack (expands on Thierry's code)
(1.33 KiB) Downloaded 8 times

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1985
Joined: Sat Dec 22, 2007 5:35 pm
Location: Genève
Contact:

Re: formattedwidth seems ignore return char in btn label

Post by jmburnod » Thu Sep 21, 2017 4:50 pm

Hi All,
bug confirmed 20405
Best
Jean-Marc

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1985
Joined: Sat Dec 22, 2007 5:35 pm
Location: Genève
Contact:

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

Post by jmburnod » Mon Nov 13, 2017 3:56 pm

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

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”