Scrollbar in a Dialog
Joerg Stahlmann Jan 24, 2011 7:01 AMHello,
referred to the Adobe Toolscript PDF I tried to add an scrollbar to my dialog.
I dont clearly understand how this works.
In my snippet the scroll is added to the dialog but I cant manage to add content to it.
Hopefully someone here can help me with that.
// CREATE new Window (GERMAN)...
var dlg = new Window('dialog', "Radiobutton Test with Scrollbar", [0, 0, 530, 150]);
// add panel...
dlg.msgPnl = dlg.add('panel', [5,20,526,105], '');
dlg.msgPnl.rbBtn1 = dlg.msgPnl.add('radiobutton', [5, 5, 100, 25], "Button1");
dlg.msgPnl.rbBtn2 = dlg.msgPnl.add('radiobutton', [5, 30, 100, 50], "Button2");
dlg.msgPnl.rbBtn3 = dlg.msgPnl.add('radiobutton', [5, 55, 100, 75], "Button3");
dlg.msgPnl.rbBtn4 = dlg.msgPnl.add('radiobutton', [5, 80, 100, 100], "Button4");
dlg.msgPnl.rbBtn5 = dlg.msgPnl.add('radiobutton', [5, 105, 100, 125], "Button5");
dlg.msgPnl.rbBtn6 = dlg.msgPnl.add('radiobutton', [5, 130, 100, 150], "Button6");
dlg.msgPnl.rbBtn7 = dlg.msgPnl.add('radiobutton', [5, 155, 100, 175], "Button7");
dlg.msgPnl.rbBtn8 = dlg.msgPnl.add('radiobutton', [5, 180, 100, 185], "Button8");
dlg.msgPnl.rbBtn9 = dlg.msgPnl.add('radiobutton', [5, 190, 100, 210], "Button9");
dlg.msgPnl.rbBtn10 = dlg.msgPnl.add('radiobutton', [5, 215, 100, 235], "Button10");
dlg.msgPnl.scrollbar = dlg.msgPnl.add('scrollbar', [(dlg.msgPnl.bounds.width-20), 0, (dlg.msgPnl.bounds.width), dlg.msgPnl.bounds.height]);
// add ok button.
dlg.okBtn = dlg.add('button', [426, 122, 526, 146], 'OK', {name:'ok'});
dlg.msgPnl.scrollbar.stepdelta = 40;
dlg.msgPnl.scrollbar.minvalue = 0;
dlg.msgPnl.scrollbar.maxvalue = dlg.msgPnl.bounds.height;
dlg.msgPnl.scrollbar.scroll = function(scrollTo) {
var pnl = this.parent;
pnl.bounds.top = -scrollTo;
pnl.bounds.bottom = -scrollTo + pnl._height;
}
dlg.msgPnl.scrollbar.onChange = function() {
var pnl = this.parent;
pnl.scrollbar.scroll(pnl.scrollbar.value);
}
dlg.msgPnl.scrollbar.onChanging = function() {
dlg.msgPnl.scrollbar.scroll(dlg.msgPnl.scrollbar.value);
}
// ONCLICK NO button...
dlg.okBtn.onClick = function() {
dlg.close(0);
}
dlg.center();
dlg.show();
Thx in advance!


