What are all the properties of a field's line?

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

Monox18
Posts: 118
Joined: Tue Nov 25, 2014 9:48 pm
Location: Deggendorf, Germany

What are all the properties of a field's line?

Post by Monox18 » Fri Dec 03, 2021 3:25 pm

I have found some properties exists such as: the backgroundColor of line i of field "myField", the padding of line i of field "myfield", etc. Where can I see a more exhaustive list of all line properties available? Can't find also in the dictionary a list. The property 'the properties of object' does this but only works with objects, not lines. Something similar maybe? Thanks!
Monox
Developing a Cyber Physical System.
https://www.monoxware.com/

Klaus
Posts: 13824
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: What are all the properties of a field's line?

Post by Klaus » Fri Dec 03, 2021 3:32 pm

Hi Monox,

there is no explicit list of properties of a line in a text field.
Check -> field Glossaray in the dictionary.
The properties of a line are a very small subset of these properties.


Best

Klaus

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

Re: What are all the properties of a field's line?

Post by dunbarx » Fri Dec 03, 2021 4:50 pm

What Klaus said.

Fields are objects and have intrinsic properties like "width" or "textSize". A "line" is a chunk expression, like "word" or "character". Chunks can be said to have "properties" if you call them that, like:

Code: Select all

the length of line 3 of fld 1
But you can see that these are not really properties, and are actually the result of a function, "the length", applied to a chunk expression.

So one can think that

Code: Select all

the foreColor of line 3 of fld 1
is a property of that line, but it is not. It is a property of a chunk of a field.

Craig

Monox18
Posts: 118
Joined: Tue Nov 25, 2014 9:48 pm
Location: Deggendorf, Germany

Re: What are all the properties of a field's line?

Post by Monox18 » Fri Dec 03, 2021 5:03 pm

Thanks guys. Found some interesting properties reading the field entry in the dictionary. Also the properties apply to any chunk rather than just lines, great!!
Monox
Developing a Cyber Physical System.
https://www.monoxware.com/

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

Re: What are all the properties of a field's line?

Post by dunbarx » Fri Dec 03, 2021 7:24 pm

Also the properties apply to any chunk rather than just lines, great!!
Exactly. You can:

Code: Select all

set the foreColor of char 3 of word 2 of line 5 of paragraph 4 of fld 7 to "yellow"
It may be 30% a matter of semantics, but the foreColor of that character, technically, is not yellow. The foreColor of what that chunk expression resolves to is yellow.

Anyway. it is fabulous that LC does that sort of thing.

Craig

stam
Posts: 2679
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: What are all the properties of a field's line?

Post by stam » Fri Dec 03, 2021 9:51 pm

Hi Monox18,

If you want to have a glance at an objects properties to see what's available (sometimes the dictionary glosses over base properties, for example in Data Grid), you can also just list them with the help of a script.

In the example below, you can run this from the multiline message box to list available properties in the message box along with any values that are set for the selected object:

Code: Select all

put the properties of the selectedObject into myArray
combine myArray using return and ": "
put myArray
Empty values often inherit from the card or other parent - so they're not really empty (for example backgroundColor).

I do this from time to time as sometimes props are not mentioned in documentation or if i want to see as specific value.
Also note that this will not show the dgProp[ ] of a data grid (but then documentation lists these fairly well...

Stam

Monox18
Posts: 118
Joined: Tue Nov 25, 2014 9:48 pm
Location: Deggendorf, Germany

Re: What are all the properties of a field's line?

Post by Monox18 » Sat Dec 04, 2021 12:13 am

Hi Stam

I did try using 'the properties'. It works for the field. But doesn't work for a chunk. The responses from the others pointed me in the right direction. Opening the field entry for type: object, and screening for [of chunk] allows me to see which properties can be applied to chunks. Tnx!
Monox
Developing a Cyber Physical System.
https://www.monoxware.com/

stam
Posts: 2679
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: What are all the properties of a field's line?

Post by stam » Sat Dec 04, 2021 12:14 am

Ah sorry - didn't get you were looking at chunk properties!

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

Re: What are all the properties of a field's line?

Post by dunbarx » Sat Dec 04, 2021 4:38 pm

Stam.

What came out of this thread is that chunks, possibly a new idea for Monox18, do not have properties. They "seem" to, because if one changes the foreColor of a char in a field to yellow, that char sure as hell looks yellow.

The point being that something real (a character) that looks yellow may not have such a property; that only fields have properties, and one can drill down into those properties to the char level.

I know *you* know this (Is that the right way to emphasize a word without shouting it?).

Craig

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

Re: What are all the properties of a field's line?

Post by dunbarx » Sat Dec 04, 2021 4:54 pm

@Monox18.

If you even need more clarification, the dictionary states that a "chunk" is "a part of the text in a container". I think that is poorly written, but my point here is that a container, a gadget that dates back to Hypercard in 1987, is anything that can hold data, a field, variable, button, URL or image. So if you have nothing better to do, like me and Richmond, think about this.

A new button on a new card:

Code: Select all

put "ABC" into button 1
answer char 2 of bin 1
You get "B" in the dialog. OK, makes sense. A button is a container and can store text. But now:

Code: Select all

set the foreColor of char 2 of btn 1 to "yellow"
LC barks. the "foreColor" property is unique to fields, not to just every container. You would get the same error if you had "ABC" in a variable and tried to set its foreColor. This is instructive in that one can see that it makes no sense to try any of those last.

A field is different; it *displays* data, and has been gifted with the ability to do things like show us a yellow character. In a sense, there should be nothing intrinsically wrong with trying to set the foreColor of a chunk in a variable, but one cannot. It is the way LC is built, and you just have to know.

Craig

Monox18
Posts: 118
Joined: Tue Nov 25, 2014 9:48 pm
Location: Deggendorf, Germany

Re: What are all the properties of a field's line?

Post by Monox18 » Sat Dec 04, 2021 6:32 pm

dunbarx wrote:
Sat Dec 04, 2021 4:38 pm
is that chunks, possibly a new idea for Monox18
In a sense yes. I have always used chunks. In loops, accessing the last char, the first char, deleting line x of, etc. I thought chunks were mere LC syntax for specific functions/commands/properties. What it's new to me is that many field's functions can be applied to either the entire field or the individual chunk. Not all but many of them. Reason of this post to find them out.

Most functions for other controls or containers only target the control as a whole and not the individual chunk. I'm now seeing the field as a much more complex object. I'd like to think a field is a collection of chunks and each chunk can be thought of an object with functions (which I call chunk properties).
dunbarx wrote:
Sat Dec 04, 2021 4:54 pm
the "foreColor" property is unique to fields, not to just every container
foreColor/foregroundColor are available to all objects. I suppose you meant only in fields this function can be also applied to chunks.

So I'm starting to think one can implement a more complex field behavior such as the Material Text Field Interactive Demo. With individual line heights as well as horizontal tabs, fields do have a customizable grid. With functions such as mouseChunk one can interact with each cell individually. Also fields allow to put icons/images in a chunk position. Hover/Pressed effects are also possible. The only things I'm uncertain and I think are not possible are the movement effects like moving a text across the cell positions. And the rounded borders: I can paint individual cells, but no idea how to create the rounded outline effect.
Monox
Developing a Cyber Physical System.
https://www.monoxware.com/

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

Re: What are all the properties of a field's line?

Post by dunbarx » Sat Dec 04, 2021 7:48 pm

foreColor/foregroundColor are available to all objects.
Well, in the sense that, say, setting the foreColor of a button does not throw an error. But it also, I believe, does not change the look of that button in any way. Possibly the only value such a property setting might have is simply to store that value. But if you need to do that, use a custom property, which seems to me much more accessible.

Craig

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

Re: What are all the properties of a field's line?

Post by dunbarx » Sat Dec 04, 2021 8:15 pm

What it's new to me is that many field's functions...
Not to put too fine a point on this, but I would not think of these chunk concepts as "functions". I know what you mean, but don't. Functions are very well defined gadgets in LC, and neither fields, nor any controls, "have" them. I would think of a field's "properties" instead, and chunks, as, er, just chunks.

Craig

Monox18
Posts: 118
Joined: Tue Nov 25, 2014 9:48 pm
Location: Deggendorf, Germany

Re: What are all the properties of a field's line?

Post by Monox18 » Sat Dec 04, 2021 8:49 pm

Alright, field's properties it is! I'm terrible at defining basic concepts even though I use them all the time :D . and the foregroundColor of a button is the text color of its entire label.
Monox
Developing a Cyber Physical System.
https://www.monoxware.com/

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

Re: What are all the properties of a field's line?

Post by dunbarx » Sat Dec 04, 2021 9:33 pm

I see that the foreColor does indeed change the text of the label.
Aha.

It is easy to be pretty good, but not easy to be perfect.

I had tested with a default button, which is drawn to the standards of the OS, and where that property has no effect. I see that the foreColor does indeed change the text of the label of an "ordinary" button.

I knew that. :wink:

Craig

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”