20,741
edits
m (→Creating the actual dialog file: magic numbers are evil ... get rid of them) |
|||
Line 33: | Line 33: | ||
<syntaxhighlight lang="nasal"> | <syntaxhighlight lang="nasal"> | ||
var DemoDialog = { | var DemoDialog = { | ||
new: func | new: func(width=140,height=160) | ||
{ | { | ||
var m = { | var m = { | ||
parents: [DemoDialog], | parents: [DemoDialog], | ||
_dlg: canvas.Window.new([ | _dlg: canvas.Window.new([width, height], "dialog") | ||
.set("title", "VBoxLayout") | .set("title", "VBoxLayout") | ||
.set("resize", 1), | .set("resize", 1), | ||
Line 57: | Line 57: | ||
var hint = vbox.sizeHint(); | var hint = vbox.sizeHint(); | ||
hint[0] = math.max( | hint[0] = math.max(width, hint[0]); | ||
m._dlg.setSize(hint); | m._dlg.setSize(hint); | ||