backColor and indented text
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
backColor and indented text
Hi,
I can't for the life of me find out how to get a line of text in a scrolling text field to have a backcolor across the whole line (width of field) when the text has a left indent set. If i use firstIndent, the indented area keeps the background color i have set, but leftIndent does not and uses the field's or cards backcolor. Some of the lines of my text wrap around, so i can't rely on first indent. I've tried margins but they only seem to be for the field as a whole - i need to do it for only a couple of lines in the field (of say 50 lines, only 10).
This is on OS X yosemite with LC 7.0.2
thanks for any help
- Mark
I can't for the life of me find out how to get a line of text in a scrolling text field to have a backcolor across the whole line (width of field) when the text has a left indent set. If i use firstIndent, the indented area keeps the background color i have set, but leftIndent does not and uses the field's or cards backcolor. Some of the lines of my text wrap around, so i can't rely on first indent. I've tried margins but they only seem to be for the field as a whole - i need to do it for only a couple of lines in the field (of say 50 lines, only 10).
This is on OS X yosemite with LC 7.0.2
thanks for any help
- Mark
Re: backColor and indented text
Hi.
Try this, with a regular field of ordinary width, with some text in it:
You cannot just set those values to "-9999999" to cover all possibilities, because the width of the field and its text needs to be managed to keep everything in range. Try it. Set one of those values to "-99999". The line disappears, because I assume the indent went off the edge of the field. If you play around with the above handler, and add or subtract text to that line, you will see what I mean. The back color will track the text if it gets too far from the index value, but fill right to the edge when you "get in range".
I have not played with this much, but I imagine the formatted width could be used to find the limits of those negative indices.
Craig Newman
Try this, with a regular field of ordinary width, with some text in it:
Code: Select all
on mouseUp
set the leftIndent of line 2 of fld 1 to -10
set the rightindent of line 2 of fld 1 to -25
set the backColor of line 2 of fld 1 to yellow
end mouseUp
I have not played with this much, but I imagine the formatted width could be used to find the limits of those negative indices.
Craig Newman
Re: backColor and indented text
Thanks Craig, I played around with this for about half an hour. The negative "offsets" work a treat for fixing the backcolor, but then of course, I lose the indenting of my text. What I don't understand is why firstIndent works the way i want (except for wrapped lines), but normal indent does not.
What I'm trying to achieve is a text field with indented text, having a number of heading lines where those heading lines have a different background colour for the whole line across the width of the field, similar to attached.
thanks again for your help
- mark
What I'm trying to achieve is a text field with indented text, having a number of heading lines where those heading lines have a different background colour for the whole line across the width of the field, similar to attached.
thanks again for your help
- mark
- Attachments
-
- indent-bc-lc.jpg (34.83 KiB) Viewed 4224 times
Re: backColor and indented text
Hmmm.
So if it true that there is no way to use any of these native tools to advantage, then, if you are an adventurous sort, I would create a set of properly sized graphic rectangles and set them at the lines of interest. This is a kluge and a half, but that would not stop me. This requires constant management, but it is simple management, and likely fun to code.
Craig
So if it true that there is no way to use any of these native tools to advantage, then, if you are an adventurous sort, I would create a set of properly sized graphic rectangles and set them at the lines of interest. This is a kluge and a half, but that would not stop me. This requires constant management, but it is simple management, and likely fun to code.
Craig
Re: backColor and indented text
Set the backcolor of the heading line, and set the leftIndent of the text line:
Code: Select all
set the backcolor of line 1 of fld 1 to "green"
set the leftIndent of line 2 of fld 1 to 18
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: backColor and indented text
Jacque.
The OP wanted the backColor of the line to extend edge to edge, regardless of the length of the text of that line. That is why I suggested using a negative indent on both sides. You just have to manage the values of those negative numbers, because if those values are too great, the text will shoot off one side or the other.
There is no mention of this in the dictionary, so I think I will add a note.
Craig
The OP wanted the backColor of the line to extend edge to edge, regardless of the length of the text of that line. That is why I suggested using a negative indent on both sides. You just have to manage the values of those negative numbers, because if those values are too great, the text will shoot off one side or the other.
There is no mention of this in the dictionary, so I think I will add a note.
Craig
Re: backColor and indented text
Or set the leftmargin and rightmargin of the field to 0, and leave the top and bottom margins bigger. If the text of the headings is too scrunched against the side, add a few spaces before the text, or a tab with a short tabstop.
The indented text lines can have their own independent left and right indents so the field margins won't matter.
The indented text lines can have their own independent left and right indents so the field margins won't matter.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com