Howto:Creating a Canvas GUI dialog file: Difference between revisions

Jump to navigation Jump to search
m
→‎Creating the actual dialog file: magic numbers are evil ... get rid of them
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([140,160], "dialog")
       _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(140, hint[0]);
     hint[0] = math.max(width, hint[0]);
     m._dlg.setSize(hint);
     m._dlg.setSize(hint);


Navigation menu