Question
Script UI message window with scrollbar includes anoying blank space
Hey,
I've created a window which displays warning message return from API, however this message is followed by a lot of blank space which is really anoying. Is there any way to calculate
content.maximumSize.height based on the size of the message that is being returned?
I was thinking about changing font to any monospace font and calculating it's height based on how many characters can fit into 1 line but it's sound like overcomplicating it, so I'm wondering if there is any easier way to accomplish it.

Here is a code that generates window showed above.
self.showMessage = function(title, header, details) {
var w = new Window('dialog', title);
w.add('statictext', undefined, header);
if(details != undefined) {
details = 'Details:\n' + details;
var panel = w.add("panel" , undefined , "");
panel.size = [650,400];
var group = panel.add("group");
group.orientation = "column";
group.alignment = "left";
var content = group.add("statictext" , undefined ,
"What is Lorem Ipsum? "
+ "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum."
+ "Why do we use it?"
+ " It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like)."
, { alignment: 'left', multiline: true });
content.minimumSize.width = 600;
var scrollBar = panel.add("scrollbar");
scrollBar.stepdelta = 10;
scrollBar.onChanging = function () {
group.location.y = -1 * this.value;
}
w.onShow = function() {
scrollBar.size = [16,panel.size.height];
scrollBar.location = [panel.size.width-20, 0];
scrollBar.maxvalue = group.size.height-panel.size.height+20;
};
}
w.add('button', undefined, 'Close', {
name: 'OK'
});
w.show();
return w;
};