Using a Palette to change DzWidget colours
HowieFarkes
Posts: 607
Using a Palette to change DzWidet colours has anyone made this work and have some code examples to show.
var oMyNewGB = new DzGroupBox();oMyNewGB.paletteBackgroundColor.setRgb( 0,0,0 ); // does nothingoMyNewGB.paletteBackgroundPixmap = new Pixmap( pathToImage ); // does nothingoMyNewGB.palette.window = new Color( 0,0,0 ); // does nothingoMyNewGB.palette.active.window = new Color( 0,0,0 ); // also does nothingoMyNewGB.palette.active.window.setRgb( 0,0,0 ); // alas also does nothingoMyNewGB.palette.window.value // returns the number 95oMyNewGB.palette.window.value = 100; // does nothing - value is still 95
So my question is - what is the magic sauce for actually changing the colour of interface widgets in script?
Post edited by HowieFarkes on
Comments
Howie, try this:
Yeah, paletteBackgroundColor() seems to work on (and only on) DzDialog. I can't seem to change the color of any other widget.
Well, I suppose one workaround might be to use a Pixmap on the Dialog which is coloured in precisely the place you want the group box.
I have hit the same problem, that for example the background and foreground colors of a DzLabel can't be manipulated via a palette, and wonder if this is expected behaviour, or rather lack of it.
I have managed to use a pixmap as the label and text via
(But the DzWidget.AlignCenter has absolutely no effect here...). This could mean creating a load of little pixmaps, which will be tedious to say the least.
Sorry, tried 5 times to get code snippet to format properly, but it refuses so I give up.
The addWidget method for DzBasicDialog has three parameters, not two. So
should do it.
Ah yes, excellent point! I'll try that at the next opportunity.
And somehow my code snippet seems to be displaying correctly now. If somebody fixed that for me, thanks!