PDA

View Full Version : Color Value Oddities


Bryan
01-16-2006, 03:58 PM
I've been banging my head against this problem for a couple of hours now, and I've finally confirmed some funkiness going on.

<canvas width="200" height="200">
<dataset name="styles">
<demo>
<style name="one" color="00FF00" bgcolor="0000FF"/>
<style name="two" color="#00FF00" bgcolor="#0000FF"/>
<style name="three" color="0x00FF00" bgcolor="0x0000FF"/>
</demo>
</dataset>

<view datapath="styles:/demo">
<simplelayout axis="y" spacing="5"/>
<text datapath="style" text="$path{'@name'}" width="100%" height="24" fgcolor="$path{'@color'}" bgcolor="$path{'@bgcolor'}"/>
</view>
</canvas>

Now, the text should be green and the background blue - and technically you should set colour values in Laszlo via '0x0000FF' (blue) instead of '#FFFFFF' as per the manual.

"A color in rgb format; for example, 0xff0000 is red."
http://www.openlaszlo.org/lps-latest/docs/reference/view.html#meth-setColor

You'd expect that both fgcolor and bgcolor attributes would take the same values '0x0000ff' - but if you run the above example it seems that fgcolor actually uses '0000FF'. I'm assuming this is actually a bug and not an undocumented feature - or am I missing something blatantly obvious here?

objectid
01-20-2006, 09:23 AM
I was just about to post a similar posting.

I did a similar thing only I used the color names in my dataset instead of numbers.

Something like this:
<step bgcolor="red">sometext</step>
<view bgcolor="$xpath{'@bgcolor'}">
Doesn't work

<step bgcolor="0xff0000">sometext</step>
Does work.

I added an event handler onbgcolor to capture the value in the debug window. Suprise, the value is exactly as it is in the dataset. Checked the typeof, both are string values 'red' and '0xff0000'.

These almost insignificant things drive me crazy everytime I start doing something that differs from the textbook examples.

I concur with Bryan that this is a bug.

objectid
01-21-2006, 03:19 AM
Even constraining a view's bgcolor to another view's bgcolor does not work. The bgcolor constraint is ignored, no errors and no effect.

What's going on with the bgcolor attribute.

claytongulick
12-28-2007, 11:16 AM
I think this is the kind of thing that drives people to use Flex. 2 hours of messing around just to try to get the text color to change on mouse over. This shouldn't be the type of thing a person has to search the forums for a solution to.