Debian Codegraph @

geanylua/docs/geanylua-input.html

raw
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN">
2 <html>
3 <head>
4 <title>The Dialog Module for Lua</title>
5 </head>
6 <body style="margin: 32px 25% 24px 5%">
7 <hr><h2>The Dialog module</h2><hr>
8 <p>
9 The <tt>dialog</tt> module provides a relatively simple way to create some fairly
10 complex dialog boxes for user interaction. &nbsp;The general idea is very loosely based on HTML forms.
11 <p>
12
13
14 <p>The functions are described below. The &nbsp;<tt>dlg</tt>&nbsp; argument expects a
15 dialog object, most other arguments are strings, unless otherwise noted.</p>
16
17 Note that you can also use these functions in object-oriented style:<br>
18 &nbsp; For instance &nbsp; <tt>dialog.label(dlg, "hello")</tt>&nbsp; <br>
19 &nbsp; can also be written as &nbsp; <tt>dlg:label("hello")</tt><br></p>
20
21
22 <br>
23
24 <hr><tt><b><big>function dialog.new ( title, buttons )</big></b></tt><br><p>
25 Creates a new dialog object. The <tt>title</tt> string assigns the window's title bar
26 text for the dialog. &nbsp; The &nbsp;<tt>buttons</tt>&nbsp; argument is a table of
27 strings, where each string will create a button with that text and add it to the
28 bottom row of the dialog. If a button's text contains an underscore, the letter after
29 it will be seen as an underlined accelerator for the button.</p>
30
31 <br>
32 <hr><tt><b><big>function dialog.run ( dlg )</big></b></tt><br>
33 <p>Displays the dialog to the user and waits for submission.</p><p>
34 This function returns two values: &nbsp;the one-based <tt>index</tt> of the the clicked button,
35 and a <tt>results</tt> table containing key-value pairs collected from the dialog's elements.</p><p>
36 If the user cancels the dialog e.g. by pressing the <tt>[Esc]</tt> key, the <tt>index</tt> will be zero, and the <tt>results</tt> table will be <tt>nil</tt>.
37 </p>
38
39 <br>
40 <hr><tt><b><big>function dialog.label ( dlg, text )</big></b></tt><br>
41 <p>Adds some informative text to the dialog.</p>
42
43
44 <br>
45 <hr><tt><b><big>function dialog.hr ( dlg )</big></b></tt><br>
46 <p>Draws a horizontal separator across the dialog.</p>
47
48 <br>
49 <hr><tt><b><big>function dialog.heading ( dlg, text )</big></b></tt><br>
50 <p>Adds a horizontal separator with some informative text below it.</p>
51 <p>This function is the same as calling the <tt>hr()</tt> and <tt>label()</tt> functions individually.</p>
52
53
54 <br>
55 <hr><tt><b><big>function dialog.text ( dlg, key, default, prompt )</big></b></tt><br>
56 <p>Creates a single-line text entry widget.</p>
57 <p>
58 The value of the <tt>key</tt> field in the <tt>results</tt> table will be set to the contents of the entry box.<br>
59 If the <tt>default</tt> string is non-nil, that text will initially be displayed in the entry box.<br>
60 The <tt>prompt</tt> string displays a label in front of the entry box to describe the requested input.
61 </p>
62
63
64 <br>
65 <hr><tt><b><big>function dialog.password ( dlg, key, default, prompt )</big></b></tt><br>
66 <p>Identical to the <tt>text()</tt> function, except that the contents of the entry box are "masked", the characters are displayed as asterisks. </p>
67
68
69 <br>
70 <hr><tt><b><big>function dialog.textarea ( dlg, key, default, caption )</big></b></tt><br>
71 <p>Creates a multi-line text entry widget.</p>
72 <p>
73 The value of the <tt>key</tt> field in the results table will be set to the contents of the text area.<br>
74 If the <tt>default</tt> string is non-nil, that text will initially be displayed in the text area.<br>
75 The <tt>caption</tt> string displays a label above the text area to describe the requested input.
76 </p>
77
78 <br>
79 <hr><tt><b><big>function dialog.checkbox ( dlg, key, default, caption )</big></b></tt><br>
80 <p>Creates an on/off toggle button.</p>
81 <p>
82 If the boolean <tt>default</tt> argument is <tt>true</tt>, the button will initially be shown in a "checked" state.<br>
83 The <tt>caption</tt> argument is the human-readable text to be displayed next to the button.
84 </p><p>
85 Note that although the default argument is boolean, the <tt>key</tt> value returned in the
86 <tt>results</tt> table will be a string, either &nbsp;<tt>"1"</tt>&nbsp;
87 for checked or &nbsp;<tt>"0"</tt>&nbsp; for unchecked.
88 </p>
89
90
91
92 <br>
93 <hr><tt><b><big>function dialog.select ( dlg, key, default, caption )</big></b></tt><br>
94 <p>Creates an empty drop-down list box.</p>
95 <p>
96 The contents of the <tt>key</tt> field in the <tt>results</tt> table will be set to the value of the selected item.<br>
97 If the <tt>default</tt> string is non-nil, the item with that value will initially be selected in the list.<br>
98 The <tt>caption</tt> string displays a label in front of the list box to describe the requested input.
99 </p>
100
101 <br>
102 <hr><tt><b><big>function dialog.option ( dlg, key, value, label )</big></b></tt><br>
103 <p>Adds an item to the drop-down list identified by <tt>key</tt>.</p>
104 <p>
105 The returned value of <tt>key</tt> will be set to this <tt>value</tt> in the <tt>results</tt> table if this item is selected.<br>
106 The <tt>label</tt> argument is the human-readable text to be displayed in the list.
107 </p>
108
109
110 <br>
111 <hr><tt><b><big>function dialog.group ( dlg, key, default, caption )</big></b></tt><br>
112 <p>Creates an empty group for radio buttons.</p><p>
113 The contents of the <tt>key</tt> field in the <tt>results</tt> table will be set to
114 the value of the selected radio button.<br>
115 If the <tt>default</tt> string is non-nil, the button with that value will initially be selected in the group.<br>
116 The <tt>caption</tt> string displays a label above of the group to describe the requested input.
117 </p>
118
119 <br>
120 <hr><tt><b><big>function dialog.radio ( dlg, key, value, label )</big></b></tt><br>
121 <p>Adds a button to the radio group identified by <tt>key</tt>.</p>
122 <p>
123 The returned value of <tt>key</tt> will be set to this <tt>value</tt> in the <tt>results</tt> table if this button is selected.<br>
124 The <tt>label</tt> argument is the human-readable text to be displayed next to this button.
125 </p>
126
127 <br>
128 <hr><tt><b><big>function dialog.file ( dlg, key, default, caption )</big></b></tt><br>
129 <p>
130 Creates a single-line text entry widget, along with a "browse" button that
131 invokes a separate file-selection dialog. <br>
132 If the user selects a filename in the file dialog, the text in the
133 entry widget will be set to the selected filename.
134 </p>
135 <p>
136 The value of the <tt>key</tt> field in the <tt>results</tt> table will be set to
137 the contents of the entry box.<br>
138 </p>
139
140
141 <br>
142 <hr><tt><b><big>function dialog.color ( dlg, key, default, caption )</big></b></tt><br>
143 <p>
144 Creates a single-line text entry widget, along with a "choose" button that
145 invokes a separate color-selection dialog. <br>
146 If the user selects a color from the dialog, the text in the
147 entry widget will be set to the selected color name in &nbsp;<tt>#RRGGBB</tt>&nbsp; format.
148 </p>
149 <p>
150 The value of the <tt>key</tt> field in the <tt>results</tt> table will be set to
151 the contents of the entry box.<br>
152 </p>
153
154
155 <br>
156 <hr><tt><b><big>function dialog.font ( dlg, key, default, caption )</big></b></tt><br>
157 <p>
158 Creates a single-line text entry widget, along with a "select" button that
159 invokes a separate font-selection dialog. <br>
160 If the user selects a font from the dialog, the text in the
161 entry widget will be set to the font name.
162 </p>
163 <p>
164 The value of the <tt>key</tt> field in the <tt>results</tt> table will be set to
165 the contents of the entry box.<br>
166 </p>
167 <br>
168
169
170
171 <hr>
172 <br><br>
173 <div align="right"><small>&copy; 2007-2008 <i>Jeff Pohlmeyer </i> &nbsp; </small></div>
174 <br><br>
175 <br><br><br><br>
176
177
178 </body>
179 </html>