TextColor glitch

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

Post Reply
Maxiogee
Posts: 38
Joined: Thu May 05, 2011 5:45 pm

TextColor glitch

Post by Maxiogee » Sun Mar 02, 2014 1:47 pm

Why does the textcolor of a field return empty when no textcolor has been set?

I set the textcolor of the first line of text in field 1 to "255,0,0"
I have left the textcolor of line 2 unchanged from the default.

I have this script in a button

Code: Select all

on mouseUp
   repeat with a = 1 to 2
      put "/" & the textcolor of line a of field 1 & "/" into line a of field 2
   end repeat
end mouseUp
This is the result

Image

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

Re: TextColor glitch

Post by Klaus » Sun Mar 02, 2014 2:01 pm

Hi,

well, that is correct bahavior :D

If you do not set a property explicitely for an object, it inherits that property from:
its enclosing group, if any -> card -> stack -> home stack, if in IDE - engine
In that case that property is in fact EMPTY!

If you want to get the inherited property, use the keyword EFFECTIVE, that will do what you want:

Code: Select all

on mouseUp
   repeat with tLine = 1 to 2
      put "/" & the EFFECTIVE textcolor of line tLine of field 1 & "/" into line tLine of field 2
   end repeat
end mouseUp
Best

Klaus

Post Reply