• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Help with scrollbar with ScriptUI

Engaged ,
Jul 15, 2017 Jul 15, 2017

Copy link to clipboard

Copied

How to make the scrollbar work perfectly by showing the other buttons ("BT4" and "BT5") that were hidden inside the panel ??

That was what I did, however, without success:

var w = new Window("dialog");

var g = w.add ("group");

var panel = g.add("panel", [0,0,150,200]);

var sbar = g.add ("scrollbar", [0,0,20,200]);

sbar.onChanging = function () {$.writeln (sbar.value)}

var b1 = panel.add("button", [0,0,0,0], "BT1") 

b1.location = [10, 12] 

b1.size = [120, 50]

var b2 = panel.add("button", [0,0,0,0], "BT2") 

       b2.location = [10, 70] 

       b2.size = [120, 50]

var b3 = panel.add("button", [0,0,0,0], "BT3") 

       b3.location = [10, 128] 

       b3.size = [120, 50]

var b4 = panel.add("button", [0,0,0,0], "BT4") 

      b4.location = [10, 186] 

      b4.size = [120, 50]

     

var b5 = panel.add("button", [0,0,0,0], "BT5") 

      b5.location = [10, 245] 

      b5.size = [120, 50]

w.show();

All tips and help will be valid. Thank you in advance.

TOPICS
Actions and scripting

Views

1.7K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Explorer ,
Jul 16, 2017 Jul 16, 2017

Copy link to clipboard

Copied

perhaps this could be of some help for you:

Scrollable panel gets truncated

Hans

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jul 17, 2017 Jul 17, 2017

Copy link to clipboard

Copied

LATEST

Hi MBA-2-rae. Thanks for the link! I have seen here this beautiful example, unfortunately I am very new to Scripting and have not been able to add my respective buttons in this script below. This is a bit tricky for my head. If please someone with more knowledge can show me replace the text options with individual buttons, I will be eternally grateful.

  1. var w = new Window('dialog');  
  2. w.maximumSize.height = 300;  
  3. var panel = w.add ('panel {alignChildren: "left"}');  
  4. var scrollGroup = panel.add('group {orientation: "column", alignChildren: "left", spacing: 5}'); 
  5. var numItems = 500
  6. var itemHeight, scrollGroupActualHeight; 
  7. for (var i = 0; i < numItems; i++) {  
  8.     scrollGroup.add('statictext', undefined, 'Label ' + i);  
  9.     }; 
  10. var scrollBar = panel.add('scrollbar {stepdelta: 1}');  
  11. scrollBar.onChanging = function () { 
  12.     var children = scrollGroup.children; 
  13.     var n; 
  14.     for (n=0; n<numItems; n++){ 
  15.         children.location.y = (n-this.value)*itemHeight; 
  16.         }; 
  17.     }; 
  18. //============================================ 
  19. w.onShow = function() {  
  20.     // Set various sizes and locations when the window is drawn  
  21.     panel.size.height = w.size.height-20;  
  22.     scrollBar.size.height = w.size.height-40;  
  23.     scrollBar.size.width = 20
  24.     scrollBar.location = [panel.size.width-30, 8]; 
  25.     
  26.     itemHeight = scrollGroup.children[0].size[1]+scrollGroup.spacing; 
  27.     scrollGroupActualHeight = panel.size[1] - panel.margins[1] - panel.margins[3];        // scrollGroup.size[1] is at the max value 
  28.     
  29.     scrollBar.maxvalue = Math.ceil(numItems-(scrollGroupActualHeight/itemHeight)); 
  30.     };  
  31. w.show();

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines