PDA

View Full Version : Question about setColor



meathome
November 27th, 2008, 19:55
Is there a way to set the backgroundcolor of a control from script? For example to mark a certain numberfield etc. Or is the only solution to make a tinted picture of the frame and define it as a different frame?

Oh and another thing, i based my stuff on foundation 0.53 and the checkbox doesnt use the specified source node. For example if i have
<checkbox name"kiuse" source=ki.use>
then it stil creates a kiuse node in the toplevel of the charsheet insted of ussinf the specified source path.

Foen
November 28th, 2008, 06:04
I'll have to get back to you on these this weekend.

Foen

Foen
November 28th, 2008, 07:00
Just had five minutes to take a look at these two questions:

I'm pretty sure setColor can be used to change the look of a control (it is used in the combat tracker when you hover over the active/passive/effects icons) but I can't see where it is documented. I think it takes an ARGB string (where the A controls transparency) and 'AND's it with the image of the control. You can also use setFrame, which is my personal preference.
Checkboxes, whether Foundation or not, use the sourcename tag rather than the source attribute. This is because they are inherited from genericcontrol, which is unbound by design:



<checkbox name='kiuse'>
<sourcename>ki.use</sourcename>
...etc...
</checkbox>


Hope that helps

Foen

Brenn
November 28th, 2008, 12:51
Just had five minutes to take a look at these two questions:
I'm pretty sure setColor can be used to change the look of a control (it is used in the combat tracker when you hover over the active/passive/effects icons) but I can't see where it is documented. I think it takes an ARGB string (where the A controls transparency) and 'AND's it with the image of the control. You can also use setFrame, which is my personal preference. Foen

I'm pretty sure that the tracker is using the setColor method for the button controls on it, which affects the icon for the button. setFrame is the way to go here. If you are using bitmap widgets, setColor is the way to go.

So yeah, you pretty much will have to tint the frame for the control externally, save it as something, set it up in graphics_frames.xml and use it from the name you set up there.

PneumaPilot
November 28th, 2008, 21:06
I'm glad he asked this question, because my work on the nWoD ruleset is going to bring me to color changing frames soon. So you're saying that swapping frames is the way to go? Does setFrame stay persistent? Oh crap, I bet you have to write an onInit function for it, don't you?