Skip to content

Instantly share code, notes, and snippets.

@indiscripts
Created March 7, 2021 20:36
Show Gist options
  • Save indiscripts/58743ac6b9304c47324edd17b21b21f0 to your computer and use it in GitHub Desktop.
Save indiscripts/58743ac6b9304c47324edd17b21b21f0 to your computer and use it in GitHub Desktop.
Testing UI Scaling vs. ScriptUI in Windows10
(function( w,t)
//----------------------------------
// Testing UI Scaling vs. ScriptUI in Windows10
{
w = new Window('dialog',"test");
w.margins = 60;
w.orientation = 'column';
(w.blue = t = w.add('group')).minimumSize = [600,400];
t.margins = 40;
t.alignChildren = ['left','top'];
t.orientation = 'column';
t.graphics.backgroundColor = t.graphics.newBrush(0,[.3,.3,.9,.5]);
t.addEventListener('mousedown',function(ev){this.helpTip = ev.screenX + ',' + ev.screenY});
(w.pink = t = t.add('group')).minimumSize = [300,150];
t.graphics.backgroundColor = t.graphics.newBrush(0,[.9,.3,.6,.5]);
(w.info = w.blue.add('statictext')).minimumSize = [450,100];
(w.green = t = w.add('group')).minimumSize = [400,100];
t.margins = 40;
t.alignChildren = ['left','top'];
t.orientation = 'column';
t.graphics.backgroundColor = t.graphics.newBrush(0,[.3,.9,.3,.5]);
(w.onShow = function onShow()
{
this.info.text = [
"window: " + callee.MX(this),
"Blue: " + callee.MX(this.blue),
"Pink: " + callee.MX(this.pink),
"Green: " + callee.MX(this.green)
].join('\n');
})
.MX = function(/*Widget|Window*/wg, xy,wh,WB)
{
xy = wg.location;
wh = wg.size;
WB = wg.windowBounds;
return "(x,y)=" + xy + " (X,Y)=" + WB.left + "," + WB.top + " (w,h)=" + wh + " (W,H)=" + WB.width + "," + WB.height;
};
// w.layout.layout(1); don't do that!!!
// w.size = [<width>,<height>]; don't do that!!!
w.show();
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment