I am trying to add a scrollbar to one of my panels (something I have tried for many years unsuccessfully).
I stumbled across Peter Kahrel's ScriptUI documentation and he has the following working code
var w = new Window('dialog'); w.maximumSize.height = 300; var panel = w.add ('panel {alignChildren: "left"}'); var scrollGroup = panel.add ('group {orientation: "column"}'); for (var i = 0; i <= 35; i++) { scrollGroup.add ('statictext', undefined, 'Label ' + i); } var scrollBar = panel.add ('scrollbar {stepdelta: 20}'); // Move the whole scroll group up or down scrollBar.onChanging = function () { scrollGroup.location.y = -1 * this.value; } w.onShow = function() { // Set various sizes and locations when the window is drawn panel.size.height = w.size.height-20; scrollBar.size.height = w.size.height-40; scrollBar.size.width = 20; scrollBar.location = [panel.size.width-30, 8]; scrollBar.maxvalue = scrollGroup.size.height - panel.size.height + 15; }; w.show();
my problem is, if I add more rows by changing line 05 to this
for (var i = 0; i <= 300; i++) {
when I scroll the panel it gets to around 35 elements and then there is just blank area in the panel beyond that row.
Anybody good with this stuff, it is something I have needed to do for a long time but adobe's documentation really sucks.