| 1 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" |
| 2 |
"http://www.w3.org/TR/html4/strict.dtd"> |
| 3 |
<html> |
| 4 |
<head> |
| 5 |
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> |
| 6 |
<title>listbox</title> |
| 7 |
<meta http-equiv="Content-Style-Type" content="text/css"> |
| 8 |
<link rel="stylesheet" href="../../style.css" type="text/css"> |
| 9 |
</head> |
| 10 |
|
| 11 |
<body> |
| 12 |
|
| 13 |
|
| 14 |
<h1>listbox</h1> |
| 15 |
|
| 16 |
<p> |
| 17 |
Displays a list box, and ask an item to user. <em>(version 4.78 or later)</em> |
| 18 |
</p> |
| 19 |
|
| 20 |
<pre class="macro-syntax"> |
| 21 |
listbox <message> <title> <string array> [<selected>] |
| 22 |
</pre> |
| 23 |
|
| 24 |
<h2>Parameters</h2> |
| 25 |
|
| 26 |
<dl> |
| 27 |
<dt class="macro">string <message></dt> |
| 28 |
<dd>It is displayed in the list box.</dd> |
| 29 |
|
| 30 |
<dt class="macro">string <title></dt> |
| 31 |
<dd>It is displayed as the list box title.</dd> |
| 32 |
|
| 33 |
<dt class="macro">array <string array></dt> |
| 34 |
<dd>It is displayed as the list box items.</dd> |
| 35 |
|
| 36 |
<dt class="macro">integer <selected> (version 4.89 or later)</dt> |
| 37 |
<dd>It is selected first item by specifying the zero-based index of the array. This argument is optional.</dd> |
| 38 |
</dl> |
| 39 |
|
| 40 |
<h2>Return Value</h2> |
| 41 |
|
| 42 |
<dl> |
| 43 |
<dt class="macro">System variable <result></dt> |
| 44 |
<dd>If the user selects one of items, it is set to from 0 to N-1.<br> |
| 45 |
If the user cancels, it is set to -1.</dd> |
| 46 |
|
| 47 |
</dl> |
| 48 |
|
| 49 |
<h2>Remarks</h2> |
| 50 |
|
| 51 |
<p> |
| 52 |
The listbox macro command shows all selected items of the <string array> array.<br /> |
| 53 |
If the <string array> is defined as bigger entries than selected numbers as follows, |
| 54 |
the empty string will be shown at last. |
| 55 |
</p> |
| 56 |
|
| 57 |
<pre> |
| 58 |
strdim msg 4 |
| 59 |
msg[0] = 'Banana' |
| 60 |
msg[1] = 'Apple' |
| 61 |
msg[2] = 'Orange' |
| 62 |
listbox 'Select your favorite food.' 'Confirmation' msg |
| 63 |
|
| 64 |
; displays 4 items |
| 65 |
Banana |
| 66 |
Apple |
| 67 |
Orange |
| 68 |
[Empty string] |
| 69 |
</pre> |
| 70 |
|
| 71 |
<p> |
| 72 |
<em>(version 4.89 or later)</em><br> |
| 73 |
When the <selected> parameter is specified, an item of the list box can be selected at first. <br /> |
| 74 |
If the parameter is omitted, the default value is 0. |
| 75 |
</p> |
| 76 |
|
| 77 |
|
| 78 |
<h2>Example</h2> |
| 79 |
|
| 80 |
<pre class="macro-example"> |
| 81 |
strdim msg 3 |
| 82 |
msg[0] = 'Banana' |
| 83 |
msg[1] = 'Apple' |
| 84 |
msg[2] = 'Orange' |
| 85 |
listbox 'Select your favorite food.' 'Confirmation' msg |
| 86 |
sprintf2 var "%d" result |
| 87 |
messagebox var "result" |
| 88 |
; result |
| 89 |
; -1: Cancel |
| 90 |
; 0: Banana |
| 91 |
; 1: Apple |
| 92 |
; 2: Orange |
| 93 |
</pre> |
| 94 |
|
| 95 |
<pre class="macro-example"> |
| 96 |
strdim msg 7 |
| 97 |
msg[0] = 'Sunny' |
| 98 |
msg[1] = 'Cloudy' |
| 99 |
msg[2] = 'Rainy' |
| 100 |
msg[3] = 'Windy' |
| 101 |
msg[4] = 'Snowy' |
| 102 |
msg[5] = 'Foggy' |
| 103 |
msg[6] = 'Unknown' |
| 104 |
; The seventh entry is selected by default. |
| 105 |
listbox "How's today's weather?" 'Confirmation' msg 6 |
| 106 |
sprintf2 var "%d" result |
| 107 |
messagebox var "result" |
| 108 |
</pre> |
| 109 |
|
| 110 |
<h2>See also</h2> |
| 111 |
<ul> |
| 112 |
<li><a href="inputbox.html">inputbox</a></li> |
| 113 |
<li><a href="passwordbox.html">passwordbox</a></li> |
| 114 |
<li><a href="setdlgpos.html">setdlgpos</a></li> |
| 115 |
<li><a href="yesnobox.html">yesnobox</a></li> |
| 116 |
</ul> |
| 117 |
|
| 118 |
</body> |
| 119 |
</html> |