Scrollbar - Iconbuttons help

Find out why the . goes before the /

Moderator: Paul Tuersley

Post Reply
sobek
Posts: 4
Joined: June 13th, 2018, 6:50 am

June 22nd, 2018, 8:54 am

Hello forum,
I found myself in a pickle while trying to populate a panel with 100 images of 86 x 120 in size .I modified petrer kahrel's example (p.73, Script UI for Dummies), and replaced the 35 static texts with my icobuttons. Up to the fifth row , all is good.After row 5 , only the half of row 6 is shown and the other 40 iconbuttons don't seem to load.Can anyone provide me any info/help ,cause I modified few of the numbers conserning the size and height but I seem to make things worse...Thank you for the help and commentsImage

Code: Select all

var hoverFile = new File("~/Desktop/Scripting_Giannis/character/green.png");  
var blueFile = new File("~/Desktop/Scripting_Giannis/character/blue.png");   // 85 x 120 size image

var Row = [];

var w = new Window('dialog');
w.maximumSize.height = 300;
var panel = w.add ('panel {alignChildren: "left"}');
var scrollGroup = panel.add ('group {orientation: "column"}');
populateScrollGroup(scrollGroup);
// }
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();


function populateScrollGroup(sGroup){
  for (var i=1;i<=20;i++){
    if ((i % 2) == 0){
      Row[i] = sGroup.add("group");
      Row[i].orientation = "row";
      Row[i].add ('iconbutton',[0,0,86,120] ,ScriptUI.newImage (blueFile),{style: "toolbutton", toggle:true} );
      Row[i].add ('iconbutton',[0,0,86,120] ,ScriptUI.newImage (blueFile),{style: "toolbutton", toggle:true} );
      Row[i].add ('iconbutton',[0,0,86,120] ,ScriptUI.newImage (blueFile),{style: "toolbutton", toggle:true} );
      Row[i].add ('iconbutton',[0,0,86,120] ,ScriptUI.newImage (blueFile),{style: "toolbutton", toggle:true} );
      Row[i].add ('iconbutton',[0,0,86,120] ,ScriptUI.newImage (blueFile),{style: "toolbutton", toggle:true} );
    } else {
      Row[i] = sGroup.add("group");
      Row[i].orientation = "row";
      Row[i].add ('iconbutton',[0,0,86,120] ,ScriptUI.newImage (hoverFile),{style: "toolbutton", toggle:true} );
      Row[i].add ('iconbutton',[0,0,86,120] ,ScriptUI.newImage (hoverFile),{style: "toolbutton", toggle:true} );
      Row[i].add ('iconbutton',[0,0,86,120] ,ScriptUI.newImage (hoverFile),{style: "toolbutton", toggle:true} );
      Row[i].add ('iconbutton',[0,0,86,120] ,ScriptUI.newImage (hoverFile),{style: "toolbutton", toggle:true} );
      Row[i].add ('iconbutton',[0,0,86,120] ,ScriptUI.newImage (hoverFile),{style: "toolbutton", toggle:true} );
    }
  }
}

Post Reply