group with backgroundColor doesn't show in Script UI

Find out why the . goes before the /

Moderator: Paul Tuersley

Post Reply
Edu-im
Posts: 5
Joined: September 28th, 2011, 10:59 am

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!

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);
beginUndoGroup
Posts: 81
Joined: November 27th, 2012, 6:41 am

I tried this in CS5.5 and all three groups showed up, with their colors. The only thing that didnt work is the helptip for group 2 (panel don't have help tips apparently).
Edu-im
Posts: 5
Joined: September 28th, 2011, 10:59 am

Thanks for checking it in CS5.5!
beginUndoGroup
Posts: 81
Joined: November 27th, 2012, 6:41 am

Small correction: i had tested this in ESTK. Just to make sure, tested again targetting AE this time and...
it worked too, with a tooltip even for the green panel.

(OS = Windows 7 btw. It might play some role, i dont know for MAC).
Post Reply