1\begin{page}{HTXAdvPage2}{Radio buttons}
2\centerline{\fbox{{\tt \thispage}}}\newline
3\begin{scroll}
4
5
6If you just want to make a multiple-choice
7type selection, why not use the {\it radio buttons}.
8
9You need to use bitmaps for the active areas (the buttons) but
10\HyperName{} will keep track of the currently activated button.
11You can use this boolean information somewhere else on your page.
12The commands to use are:
13\beginImportant
14\newline
15{\tt \\radioboxes\{{\it group name}\}\{{\it bitmap file1}\}\{{\it bitmap file0}\}}
16\newline
17{\tt \\radiobox[{\it initial state}]\{{\it label}\}\{{\it group name}\}}
18\newline
19{\tt \\boxvalue\{{\it label}\}}
20\endImportant
21
22The {\tt \\radioboxes} command sets up a group of {\tt \\radiobox}
23buttons. The {\it group name} is a label for the group. The filenames
24for the bitmaps are specified in {\it bitmap file1} and {\it bitmap file0}.
25The first one should denote an activated button and the second
26a de-activated one.
27
28To display each button in a group, use {\tt \\radiobox}.
29The {\it initial state} should be either {\tt 1} or {\tt 0}
30depending on whether the button should first be displayed as activated or not.
31The second {\it label} argument defines the name by which the
32current state of the button can be referred to.
33The third argument specifies which group this button belongs to.
34
35The {\tt \\boxvalue} command can then be used in various
36actions. The value of it will
37be either {\tt t} or {\tt nil}.
38
39In the example below, we use the {\tt \\htbmfile} macro
40defined in {\bf util.ht} so that we do not have to write
41the full bitmap file pathnames.
42
43This is how we set up the group. The {\tt \\radioboxes} command does not display
44anything.
45Note that these commands cannot be included in a {\it patch}.
46This is why we display this time the source and the result
47at the same time.
48\beginImportant
49\newline
50{\tt \\radioboxes\{group\}\{\\htbmfile\{pick\}\}\{\\htbmfile\{unpick\}\}}\newline
51{\tt \\newline \\table\{}\newline
52{\tt \{\\radiobox[1]\{b1\}\{group\}\}}\newline
53{\tt \{\\radiobox[0]\{b2\}\{group\}\}}\newline
54{\tt \{\\radiobox[0]\{b3\}\{group\}\}\}}\newline
55{\tt \\newline}\newline
56{\tt \\lispcommand\{lisp\}\{(pprint (list}\newline
57{\tt \\boxvalue\{b1\} \\boxvalue\{b2\} \\boxvalue\{b3\}))\}}\newline
58{\tt \\newline}\newline
59{\tt \\unixcommand\{unix\}\{echo '\\boxvalue\{b1\}}\newline
60{\tt \\boxvalue\{b2\} \\boxvalue\{b3\}'\}}
61\endImportant
62\radioboxes{group}{\htbmfile{pick}}{\htbmfile{unpick}}
63\table{
64{\radiobox[1]{b1}{group}}
65{\radiobox[0]{b2}{group}}
66{\radiobox[0]{b3}{group}}}
67\newline
68\lispcommand{lisp}{(pprint (list
69\boxvalue{b1} \boxvalue{b2} \boxvalue{b3}))}
70\newline
71\unixcommand{unix}{echo '\boxvalue{b1}
72\boxvalue{b2} \boxvalue{b3}'}
73\endImportant
74
75
76
77
78You can only set one radio button at a time. If you want
79a non--exclusive selection, try {\tt \\inputbox}.
80The syntax for this command is
81\beginImportant
82\newline
83{\tt \\inputbox[{\it initial state}]\{{\it label}\}\{{\it bitmap file1}\}\{{\it bitmap file0}\}}
84\endImportant
85
86There is no group command for these.
87\beginImportant
88\newline
89{\tt \\table\{}\newline
90{\tt \{\\inputbox[1]\{c1\}\{\\htbmfile\{pick\}\}\{\\htbmfile\{unpick\}\}\}}\newline
91{\tt \{\\inputbox\{c2\}\{\\htbmfile\{pick\}\}\{\\htbmfile\{unpick\}\}\}}\newline
92{\tt \{\\inputbox[1]\{c3\}\{\\htbmfile\{pick\}\}\{\\htbmfile\{unpick\}\}\}\}}\newline
93{\tt \\newline}\newline
94{\tt \\lispcommand\{lisp\}\{(pprint (list}\newline
95{\tt \\boxvalue\{c1\} \\boxvalue\{c2\} \\boxvalue\{c3\}))\}}\newline
96{\tt \\newline}\newline
97{\tt \\unixcommand\{unix\}\{echo }\newline
98{\tt '\\boxvalue\{c1\} \\boxvalue\{c2\} \\boxvalue\{c3\}'\}}\newline
99\endImportant
100\table{
101{\inputbox[1]{c1}{\htbmfile{pick}}{\htbmfile{unpick}}}
102{\inputbox{c2}{\htbmfile{pick}}{\htbmfile{unpick}}}
103{\inputbox[1]{c3}{\htbmfile{pick}}{\htbmfile{unpick}}}}
104\newline
105\lispcommand{lisp}{(pprint (list
106\boxvalue{c1} \boxvalue{c2} \boxvalue{c3}))}
107\newline
108\unixcommand{unix}{echo
109'\boxvalue{c1} \boxvalue{c2} \boxvalue{c3}'}
110\endImportant
111
112
113Note that the {\it initial state} is an
114optional argument. If omitted
115the button will initially
116be deactivated.
117
118\end{scroll}
119\beginmenu
120\menulink{Next Page --- Macros}{HTXAdvPage3}
121\endmenu
122
123\end{page}
124