group with backgroundColor doesn't show in Script UI
Posted: June 5th, 2013, 12:32 pm
hi everyone
I'm having a strange problem. I'm working on CS5 Windows and I know that this problem doesn't affect CS6. No idea about CS5.5.
This is the issue. I create a UI with several Groups with a backgroundColor set. If it runs as a Window, there's no problem. But if it runs as a Panel, the groups doesn't show. But I know they're there, because I can read the helpTip when I'm over them. If I use Panel instead of Group, the color shows, but due to a different part of my code, this is not an option.
Here it is some code showing the problem. Thanks!
I'm having a strange problem. I'm working on CS5 Windows and I know that this problem doesn't affect CS6. No idea about CS5.5.
This is the issue. I create a UI with several Groups with a backgroundColor set. If it runs as a Window, there's no problem. But if it runs as a Panel, the groups doesn't show. But I know they're there, because I can read the helpTip when I'm over them. If I use Panel instead of Group, the color shows, but due to a different part of my code, this is not an option.
Here it is some code showing the problem. Thanks!
Code: Select all
function colorGroup (thisObj) {
// create ui
function createUI (thisObj) {
if (thisObj instanceof Panel) {
var win = thisObj;
} else {
var win = new Window ("palette", "Color Groups", undefined, {resizeable:true});
}
if (win != null) {
win.layout.layout(true);
win.layout.resize();
printColors (win);
}
return win;
}
// create color groups
function printColors (ui) {
ui.gr_one = ui.add("group");
ui.gr_one.location = [margin,margin];
ui.gr_one.size = [size*3,size];
ui.gr_one.graphics.backgroundColor = ui.gr_one.graphics.newBrush(ui.gr_one.graphics.BrushType.SOLID_COLOR, [1,0,0,1]);
ui.gr_one.helpTip = "red";
ui.gr_two = ui.add("panel",undefined,"");
ui.gr_two.location = [margin,margin + size];
ui.gr_two.size = [size*3,size];
ui.gr_two.graphics.backgroundColor = ui.gr_two.graphics.newBrush(ui.gr_two.graphics.BrushType.SOLID_COLOR, [0,1,0,1]);
ui.gr_two.helpTip = "green";
ui.gr_three = ui.add("group");
ui.gr_three.location = [margin,margin + (size*2)];
ui.gr_three.size = [size*3,size];
ui.gr_three.graphics.backgroundColor = ui.gr_three.graphics.newBrush(ui.gr_three.graphics.BrushType.SOLID_COLOR, [0,0,1,1]);
ui.gr_three.helpTip = "blue";
}
// variables
var size = 50;
var margin = 5;
// run ui
var win = createUI (thisObj);
if (win != null && win instanceof Window) {
win.size = [200,210];
win.show();
win.center();
} else if (win instanceof Panel) {
}
}
colorGroup (this);