1
0
Fork 0

make dialog resizable with Ctrl-dragging

This commit is contained in:
mfranz 2009-01-10 21:59:27 +00:00
parent 071eb664f8
commit b38cf98aa1
3 changed files with 33 additions and 7 deletions

View file

@ -11,6 +11,7 @@
<name>file-select</name>
<dialog-name>file-select</dialog-name>
<layout>vbox</layout>
<resizable>true</resizable>
<pref-width>450</pref-width>
<group>
@ -45,6 +46,7 @@
<input>
<name>dir-input</name>
<pref-width>442</pref-width>
<halign>fill</halign>
<property>/sim/gui/dialogs/file-select/directory</property>
<live>1</live>
<binding>
@ -60,7 +62,9 @@
<list>
<name>list</name>
<halign>fill</halign>
<pref-height>350</pref-height>
<valign>fill</valign>
<stretch>true</stretch>
<pref-height>300</pref-height>
<property>/sim/gui/dialogs/file-select/selection</property>
<binding>
<command>dialog-apply</command>
@ -78,6 +82,8 @@
<input>
<name>file-input</name>
<pref-width>230</pref-width>
<halign>fill</halign>
<stretch>true</stretch>
<property>/sim/gui/dialogs/file-select/selection</property>
<live>1</live>
<binding>

View file

@ -4,7 +4,9 @@
<x>-20</x>
<y>-20</y>
<name>nasal-console</name>
<dialog-name>nasal-console</dialog-name>
<layout>vbox</layout>
<resizable>true</resizable>
<group>
<layout>hbox</layout>
@ -34,6 +36,8 @@
<textbox>
<name>editfield</name>
<halign>fill</halign>
<valign>fill</valign>
<stretch>true</stretch>
<pref-width>450</pref-width>
<pref-height>200</pref-height>
<slider>20</slider>
@ -89,7 +93,8 @@
<button>
<legend>?</legend>
<pref-width>30</pref-width>
<pref-width>20</pref-width>
<pref-height>20</pref-height>
<binding>
<command>nasal</command>
<script>help()</script>
@ -147,13 +152,21 @@
<nasal>
<open>
var self = cmdarg();
var dlg = props.globals.getNode("/sim/gui/dialogs/nasal-console", 1);
var kbdctrl = props.globals.getNode("/devices/status/keyboard/ctrl", 1);
var printf = func { print(call(sprintf, arg)) }
var edit = dlg.getNode("edit", 1);
if (!contains(globals, "__nasal_console"))
globals["__nasal_console"] = {};
var maxwidth = getprop("/sim/startup/xsize") - 50;
var maxheight = getprop("/sim/startup/ysize") - 100;
var width = dlg.initNode("width", 450, "INT");
var height = dlg.initNode("height", 200, "INT");
width.setAttribute("userarchive", 1);
height.setAttribute("userarchive", 1);
self.getNode("textbox").setValues({ "pref-width": width.getValue(), "pref-height": height.getValue() });
var locals = globals["__nasal_console"];
var numtabs = size(dlg.getChildren("code"));
if (!numtabs)
@ -190,7 +203,7 @@
debug.printerror(err);
}
var tabs = cmdarg().getNode("group[1]");
var tabs = self.getNode("group[1]");
var select = func(which, init = 0) {
if (active) { # false in help mode
dlg.getNode("active").setIntValue(active);

View file

@ -3,6 +3,7 @@
<PropertyList>
<name>property-browser</name>
<layout>vbox</layout>
<resizable>true</resizable>
<default-padding>3</default-padding>
<group>
@ -53,8 +54,10 @@
<property-list>
<name>property-list</name>
<pref-width>450</pref-width>
<pref-height>250</pref-height>
<halign>fill</halign>
<valign>fill</valign>
<stretch>true</stretch>
<property>/sim/gui/dialogs/property-browser/list</property>
<binding>
<command>dialog-apply</command>
@ -75,13 +78,17 @@
<text>
<label>--</label>
<live>true</live>
<halign>fill</halign>
<stretch>true</stretch>
<property>/sim/gui/dialogs/property-browser/label</property>
<pref-width>190</pref-width>
<pref-width>170</pref-width>
</text>
<input>
<name>input</name>
<pref-width>190</pref-width>
<halign>fill</halign>
<stretch>true</stretch>
<pref-width>170</pref-width>
<property>/sim/gui/dialogs/property-browser/input</property>
</input>