What controls the space between lines in a field?

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

sritcp
Posts: 431
Joined: Tue Jun 05, 2012 5:38 pm

What controls the space between lines in a field?

Post by sritcp » Sat Feb 01, 2020 3:20 am

I have two fields (see image below). The top one is a label field, the bottom one, regular field.
There is no other difference between the two. The font, textSize, textHeight, are all identical.
The line height is not fixed; however, there are no funny chars or mixed size chars in the fields.

Is it just me, or do the fields look different, with more space between the lines and less crowded characters within the line itself?
What might be the cause?

font: (text)
size: 13
text height: 17

Regards,
Sri
Attachments
linespace.png
linespace.png (13.18 KiB) Viewed 8883 times

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10049
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: What controls the space between lines in a field?

Post by FourthWorld » Sat Feb 01, 2020 4:22 am

Check the fixedLineHeight of each field.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10320
Joined: Wed May 06, 2009 2:28 pm

Re: What controls the space between lines in a field?

Post by dunbarx » Sat Feb 01, 2020 4:55 pm

Hi.

A fresh new label field and a fresh new regular field look identical to me with the same text.

Get "the properties" of each field and compare them line by line. I made a gadget many years ago to extract the properties that do not match between two such lists.

Craig

sritcp
Posts: 431
Joined: Tue Jun 05, 2012 5:38 pm

Re: What controls the space between lines in a field?

Post by sritcp » Sat Feb 01, 2020 6:59 pm

FourthWorld wrote:
Sat Feb 01, 2020 4:22 am
Check the fixedLineHeight of each field.
Checking the fixedLineHeight increases the space between lines.
The text in the two fields still look different. The fonts seem to be different.
The font property for both say "(text)" and grayed out.
The text font of the stack returns empty, so (I presume) it inherits the font from the system.
One difference between the two fields is that the bottom field is inside a group and the font property for the group says "(system)".

Thanks,
Sri
Attachments
linespace1.png
linespace1.png (13.33 KiB) Viewed 8792 times

sritcp
Posts: 431
Joined: Tue Jun 05, 2012 5:38 pm

Re: What controls the space between lines in a field?

Post by sritcp » Sun Feb 02, 2020 12:59 am

I am unable to reproduce this problem in a fresh stack.
The label field must be corrupted, somehow.
As I increase its textSize, only the line height is adjusted. The font size remains at 12 (although the inspector shows 13, 14, ... as I modify).
I'll just delete that field and redo.

Sorry for wasting your time, folks!

Regards,
Sri

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10049
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: What controls the space between lines in a field?

Post by FourthWorld » Sun Feb 02, 2020 3:21 am

Are you setting the font size of the field object, or the text within it?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

sritcp
Posts: 431
Joined: Tue Jun 05, 2012 5:38 pm

Re: What controls the space between lines in a field?

Post by sritcp » Sun Feb 02, 2020 5:11 pm

FourthWorld wrote:
Sun Feb 02, 2020 3:21 am
Are you setting the font size of the field object, or the text within it?
Never realized the distinction!
I set the textSize of the field with either

set the textSize of selObj() to 14
or
set the textSize of field "MyField" to 14

When I try

set the textSize of the text of field "MyField" to 14
I get the execution error:
Error description: Chunk: error in object expression

I did not try
set the textSize of the selectedText of field "MyField" to 14
since it is a label field.

Regards,
Sri

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10320
Joined: Wed May 06, 2009 2:28 pm

Re: What controls the space between lines in a field?

Post by dunbarx » Sun Feb 02, 2020 5:26 pm

Hi,

You cannot set the textSize of "the text". In the situation that Richard is talking about, set a chunk expression:

Code: Select all

set the textSize of char 1 to (the length of fld 1) of  fld 1 to "22"
This sets the whole text. It is less silly than:

Code: Select all

set the textSize of char 1 to 1000000 of  fld 1 to "22"
Craig

kaveh1000
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 539
Joined: Sun Dec 18, 2011 7:23 pm
Contact:

Re: What controls the space between lines in a field?

Post by kaveh1000 » Sun Feb 02, 2020 5:43 pm

or

Code: Select all

char 1 to -1 of fld 1... 
?
Kaveh

sritcp
Posts: 431
Joined: Tue Jun 05, 2012 5:38 pm

Re: What controls the space between lines in a field?

Post by sritcp » Sun Feb 02, 2020 5:44 pm

Craig:

This is interesting!
Your code works. In fact, setting it to empty with

Code: Select all

set the textSize of char 1 to (the length of fld 1) of  fld 1 to empty
solved the problem, and the text "inherited" the textSize of the field (which itself is empty, and inherits, I presume, from the system).

This means something was "intercepting" the field setting from reaching the text. I wonder what?

Thanks,
Sri

Klaus
Posts: 14194
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: What controls the space between lines in a field?

Post by Klaus » Sun Feb 02, 2020 5:44 pm

kaveh1000 wrote:
Sun Feb 02, 2020 5:43 pm
or

Code: Select all

char 1 to -1 of fld 1... 
?
Yes.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10320
Joined: Wed May 06, 2009 2:28 pm

Re: What controls the space between lines in a field?

Post by dunbarx » Sun Feb 02, 2020 5:54 pm

Sri,

Glad to hear, and you have all that right.

Just to go back, the "text" is a property, as is the "textSize", and if you think about it, you cannot set a property of a property. It would be the same as trying to set, say, the backColor of the topLeft...

Craig

sritcp
Posts: 431
Joined: Tue Jun 05, 2012 5:38 pm

Re: What controls the space between lines in a field?

Post by sritcp » Sun Feb 02, 2020 8:56 pm

Craig:

Yes, I see that!
I realized the effort to make LC script more English-like and forgiving of loose syntax has created some pitfalls for non-experts like me.
For example,
the selectedText of field "MyField"
is a function, not a property!
I have been tripped up by such "oddities" more than once!

Regards,
Sri

Klaus
Posts: 14194
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: What controls the space between lines in a field?

Post by Klaus » Sun Feb 02, 2020 9:46 pm

Yep, that's why we can also script (more function-like):

Code: Select all

...
put selectedText(fld "MyField")
...
put height(btn 3)
...
## etc...
...
## And also:
...
put the sum of "1,2,3,4"
### instead of
put sum(1,2,3,4)
...
:D

sritcp
Posts: 431
Joined: Tue Jun 05, 2012 5:38 pm

Re: What controls the space between lines in a field?

Post by sritcp » Mon Feb 03, 2020 2:14 am

Klaus wrote:
Sun Feb 02, 2020 9:46 pm
Yep, that's why we can also script (more function-like):...........
Sure, yes, but that would lose the English-like syntax ...
(that was my point -- to be able to use the natural language form, but keep an eye open for the potholes!).

Regards,
Sri

Post Reply