Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Use this to paint a group or a panel object by passing the object variable and an RGBA color ([x,x,x,x])
function FillPanel(panelOBJ, color) {
if (
panelOBJ &&
color &&
(panelOBJ.type == "panel" ||
panelOBJ.type == "group" ||
panelOBJ.type == "dialog" ||
panelOBJ.type == "palette" ||
panelOBJ.type == "window") &&
panelOBJ.graphics.BrushType
) {
try {
color[3] = color[3] == undefined ? 1 : color[3];
if (!(color.length >= 3)) {
// color is not propper rgb array
return;
}
var g = panelOBJ.graphics;
if (g !== undefined) {
g.backgroundColor = g.newBrush(g.BrushType.SOLID_COLOR, color);
}
} catch (e) {
// something went wrong, you could print or alet an error here
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment