I have a panel where there is a check box.
It's possible to set borderStyle:"black" of panel when the value of check box is true and normal
when the value is false?
Thanks
border style
border style
I try to explane:
I have a panel.
win.p1 = win.add("panel", [10,20,300,100], "Layer section");
and one check box on this panel that enable or disable layer function.
I try with:
win.p1.graphics.font = ScriptUI.newFont("Arial","BOLD",12);
that work ok but for me is not important the size and the font, is important only border style of the panel.
The result will be like:
win.p1 = win.add("panel", [10,20,300,100], "Layer section", {borderStyle:"black"});
There is a solution?
I have a panel.
win.p1 = win.add("panel", [10,20,300,100], "Layer section");
and one check box on this panel that enable or disable layer function.
I try with:
win.p1.graphics.font = ScriptUI.newFont("Arial","BOLD",12);
that work ok but for me is not important the size and the font, is important only border style of the panel.
The result will be like:
win.p1 = win.add("panel", [10,20,300,100], "Layer section", {borderStyle:"black"});
There is a solution?
border style
Not that I know of, maybe you could change the Panel background colour IE:
Code: Select allvar win = new Window("dialog","test");
win.pnl1 = win.add("panel");
g = win.pnl1.graphics;
g.backgroundColor = g.newBrush(g.BrushType.SOLID_COLOR, [1.00, 1.00, 1.00, 1]);
win.pnl1.cb1 = win.pnl1.add('checkbox',undefined,'Check Me');
win.pnl1.bu1 = win.pnl1.add('button',undefined,'Cancel');
win.pnl1.cb1.onClick= function(){
if(win.pnl1.cb1.value){
g.backgroundColor= g.newBrush(g.BrushType.SOLID_COLOR, [1.00, 0.00, 0.00, 1]);
}else{
g.backgroundColor = g.newBrush(g.BrushType.SOLID_COLOR, [1.00, 1.00, 1.00, 1]);
}
}
win.center();
win.show();
Code: Select allvar win = new Window("dialog","test");
win.pnl1 = win.add("panel");
g = win.pnl1.graphics;
g.backgroundColor = g.newBrush(g.BrushType.SOLID_COLOR, [1.00, 1.00, 1.00, 1]);
win.pnl1.cb1 = win.pnl1.add('checkbox',undefined,'Check Me');
win.pnl1.bu1 = win.pnl1.add('button',undefined,'Cancel');
win.pnl1.cb1.onClick= function(){
if(win.pnl1.cb1.value){
g.backgroundColor= g.newBrush(g.BrushType.SOLID_COLOR, [1.00, 0.00, 0.00, 1]);
}else{
g.backgroundColor = g.newBrush(g.BrushType.SOLID_COLOR, [1.00, 1.00, 1.00, 1]);
}
}
win.center();
win.show();
border style
It seems that Paul is right. Although you can change the borderStyle of the panel in the checkbox's onClick handler, the window does not show the change and only displays the style used when the control was created.
Code: Select all var win = new Window("dialog","test");
win.pnl1 = win.add("panel",undefined,'test',{borderStyle:'sunken'});
win.pnl1.cb1 = win.pnl1.add('checkbox',undefined,'Check Me');
win.pnl1.bu1 = win.pnl1.add('button',undefined,'Cancel');
win.pnl1.cb1.onClick= function(){
var w = FindDialog(this);
if(this.value){
w.pnl1.properties.borderStyle = 'black';
}else{
w.pnl1.properties.borderStyle = 'etched';
}
w.hide();// try to refresh the dialog
w.show();// but doesn't help
}
win.center();
win.show();
alert(win.pnl1.properties.borderStyle);
/*//////////////////////////////////////////////////////////////////////////////
// Function: FindDialog
// Usage: From a deeply grouped dialog item go up til you find the parent dialog
// Input: Current dialog item, an actual item or a group
// Return: top parent dialog
//////////////////////////////////////////////////////////////////////////////*/
function FindDialog( inItem ) {
var w = inItem;
while ( 'dialog' != w.type ) {
if ( undefined == w.parent ) {
w = null;
break;
}
w = w.parent;
}
return w;
}Note that after running a few times this crashes ESTK on my system.
Code: Select all var win = new Window("dialog","test");
win.pnl1 = win.add("panel",undefined,'test',{borderStyle:'sunken'});
win.pnl1.cb1 = win.pnl1.add('checkbox',undefined,'Check Me');
win.pnl1.bu1 = win.pnl1.add('button',undefined,'Cancel');
win.pnl1.cb1.onClick= function(){
var w = FindDialog(this);
if(this.value){
w.pnl1.properties.borderStyle = 'black';
}else{
w.pnl1.properties.borderStyle = 'etched';
}
w.hide();// try to refresh the dialog
w.show();// but doesn't help
}
win.center();
win.show();
alert(win.pnl1.properties.borderStyle);
/*//////////////////////////////////////////////////////////////////////////////
// Function: FindDialog
// Usage: From a deeply grouped dialog item go up til you find the parent dialog
// Input: Current dialog item, an actual item or a group
// Return: top parent dialog
//////////////////////////////////////////////////////////////////////////////*/
function FindDialog( inItem ) {
var w = inItem;
while ( 'dialog' != w.type ) {
if ( undefined == w.parent ) {
w = null;
break;
}
w = w.parent;
}
return w;
}Note that after running a few times this crashes ESTK on my system.