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

Scrollbar truncates contents (using ScriptUI)

Guest
Jan 21, 2021 Jan 21, 2021

Copy link to clipboard

Copied

I have problem with generating long dialog. I add scrollbar, create 41 rows, but in real created are only rows to 31. (I added higher scrollbar to see whole last elements)

 

var w = new Window('dialog');
w.maximumSize.height = 400;
var panel = w.add ('panel {alignChildren: "left"}');
var scrollGroup = panel.add ('group {orientation: "column"}');

var scrollBar = panel.add ('scrollbar {stepdelta: 10}');

for (var i = 0; i <= 40; i++) {
var group = scrollGroup.add ("group");
group.edit = group.add ("edittext", undefined, scrollGroup.children.length);
}

// Move the whole scroll group up or down
scrollBar.onChanging = function () {
scrollGroup.location.y = -2 * 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-20;
scrollBar.size.width = 20;
scrollBar.location = [panel.size.width-30, 8];
scrollBar.maxvalue = scrollGroup.size.height - panel.size.height + 15;
};
w.show();

 

TOPICS
Bug , Scripting

Views

240

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
Participant ,
Jan 21, 2021 Jan 21, 2021

Copy link to clipboard

Copied

LATEST

hi, maybe the code below will help you

var myWindow = new Window('dialog','test',undefined)
	
var len = 100
var size = 1
	
var myTopPanel = myWindow.add('panel',undefined,'scroll')
myTopPanel.size = [200,500]

var myGroup = myTopPanel.add('group')
myGroup.orientation = 'column'
for(var i = 0; i < len; i++){
	myGroup.add('edittext',undefined,'item '+(i+1))
	size+= myGroup.children[i].preferredSize[1]
}
myGroup.maximumSize.height = myGroup.children.length*size
	
var myScrollBar = myTopPanel.add('scrollbar')
myScrollBar.stepdelta = myGroup.children.length
myScrollBar.jumpdelta = myGroup.children.length*10
myScrollBar.onChanging = function(){myGroup.location.y = -1*this.value}

myWindow.onShow = function(){
	myScrollBar.bounds = [myTopPanel.size.width-20,0,myTopPanel.size.width-5,myTopPanel.size.height-10]
	myScrollBar.maxvalue = myGroup.size.height-myTopPanel.size.height+10
}
myWindow.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