ScriptUI is wonderful, but seems to have some limitations. I am looking for an ability to dynamically resize a dialog window based on an action taken on one of the controls inside of it, such as an .onClick()
or .onShow()
callback. However, the only way I've seen for the window to be resized is before it is drawn on the screen with the .show()
method. Once the window has been shown, it appears that there is no way for a control to resize it. Please tell me I am wrong and there is a way to do this.
问问题
1352 次
1 回答
1
Mostly based on Peter Kahrels ScriptUI Guide
var w = new Window ("dialog");
var b = w.add('button',undefined,'Click me');
var small = false;
//~ w.onShow = function () {
//~ w.size = {width: 300, height: 400};
//~ }
b.onClick = function(){
small = !small;
if(small == false){
w.size = {width: 300, height: 400};
}else{
w.size = {width: 100, height: 100};
}
}
w.show();
于 2013-09-05T14:17:08.920 回答