Ineffective backGroundColor

Mark Waddingham mark at livecode.com
Fri Dec 18 06:14:31 EST 2015


Hi Richmond,

On 2015-12-16 20:33, Richmond wrote:
> On 16/12/15 20:49, Richmond wrote:
>> Why, if I set the backGroundColor of an object using a 3 number code 
>> (RGB)
>> am I able to do a:
>> 
>> put the backGroundColor and get those 3 values,
>> 
>> while if I set the backGroundColor of an object using a colorName
>> am I UNABLE to get the RGB values using a:
>> 
>> put the backGroundColor ???

The 'color' properties of controls remember whether you set them to a 
named color, or to an RGB triple.

>> what is the point of the 'effective' in
>> 
>> effective backgroundColor

If a control's *color property is empty it will inherit from the first 
non-empty ancestor. Using effective means you see the concrete value. 
e.g.

   group 1 -- backgroundColor == red
     field 1 -- empty backgroundColor

   put the backgroundColor of field 1 -- empty
   put the backgroundColor of group 1 -- red
   put the effective backgroundColor of field 1 -- red

> Um: set the backgroundPixel of someObject to the backgroundPixel of 
> someObject
> 
> boy-O-boy: was somebody feeling bloody-minded the day that 'thing' was
> implemented :)

Getting the backgroundPixel will encode any named color as RGB values, 
and setting the backgroundPixel will end up setting the backgroundColor 
to a non-named color with the derived RGB tripe - which is why you can 
use that line of code to convert named colors to their RGB counterparts.

Of course, one could argue there should be a more obvious way :)

Warmest Regards,

Mark.

-- 
Mark Waddingham ~ mark at livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps




More information about the use-livecode mailing list