1DIALOG(3) Library Functions Manual DIALOG(3)
2
3
4
6 dialog - widgets and utilities for the dialog program
7
9 cc [ flag ... ] file ... -ldialog [ library ... ]
10 or
11 cc $(dialog-config --cflags) file ... $(dialog-config --libs) ]
12
13 #include <dialog.h>
14
15 Dialog is a program that will let you present a variety of questions or
16 display messages using dialog boxes from a shell script. It is built
17 from the dialog library, which consists of several widgets as well as
18 utility functions that are used by the widgets or the main program.
19
21 This manpage documents the features from <dialog.h> which are likely to
22 be important to developers using the widgets directly. Some hints are
23 also given for developing new widgets.
24
25 Here is a dialog version of Hello World:
26 int main(void)
27 {
28 int status;
29 init_dialog(stdin, stdout);
30 status = dialog_yesno(
31 "Hello, in dialog-format",
32 "Hello World!",
33 0, 0);
34 end_dialog();
35 return status;
36 }
37
39 Exit codes (passed back to the main program for its use) are defined
40 with a "DLG_EXIT_ prefix. The efined constants can be mapped using en‐
41 vironment variables as described in dialog(1), e.g., DLG_EXIT_OK corre‐
42 sponds to $DIALOG_OK.
43
44 Useful character constants which correspond to user input are named
45 with the "CHR_" prefix, e.g., CHR_BACKSPACE.
46
47 Colors and video attributes are categorized and associated with set‐
48 tings in the configuration file (see the discussion of $DIALOGRC in di‐
49 alog(1)). The DIALOG_ATR(n) macro is used for defining the references
50 to the combined color and attribute table dlg_color_table[].
51
52 The dialog application passes its command-line parameters to the widget
53 functions. Some of those parameters are single values, but some of the
54 widgets accept data as an array of values. Those include checklist/ra‐
55 diobox, menubox and formbox. When the --item-help option is given, an
56 extra column of data is expected. The USE_ITEM_HELP(), CHECKBOX_TAGS,
57 MENUBOX_TAGS and FORMBOX_TAGS macros are used to hide this difference
58 from the calling application.
59
60 Most of the other definitions found in <dialog.h> are used for conve‐
61 nience in building the library or main program. These include defini‐
62 tions based on the generated <dlg_config.h> header.
63
65 All of the global data for the dialog library is stored in a few struc‐
66 tures: DIALOG_STATE, DIALOG_VARS and DIALOG_COLORS. The corresponding
67 dialog_state, dialog_vars and dlg_color_table global variables should
68 be initialized to zeros, and then populated with the data to use. A
69 few of these must be nonzero for the corresponding widgets to function.
70 As as the case with function names, variables beginning with "dialog_"
71 are designed for use by the calling application while variables begin‐
72 ning with "dlg_" are intended for lower levels, e.g., by the dialog li‐
73 brary.
74
76 The state variables are dialog's working variables. It initializes
77 those, uses them to manage the widgets.
78
79 .all_subwindows
80 This is a linked list of all subwindows created by the library. The
81 dlg_del_window function uses this to free storage for subwindows when
82 deleting a window.
83
84 .all_windows
85 This is a linked list of all windows created by the library. The
86 dlg_del_window function uses this to locate windows which may be re‐
87 drawn after deleting a window.
88
89 .aspect_ratio
90 This corresponds to the command-line option "--aspect-ratio". The
91 value gives the application some control over the box dimensions when
92 using auto sizing (specifying 0 for height and width). It represents
93 width / height. The default is 9, which means 9 characters wide to ev‐
94 ery 1 line high.
95
96 .finish_string
97 When set to true, this allows calls to dlg_finish_string to discard the
98 corresponding data which is created to speed up layout computations for
99 the given string parameter. The gauge widget uses this feature.
100
101 .getc_callbacks
102 This is set up in ui_getc.c to record windows which must be polled for
103 input, e.g., to handle the background tailbox widget. One window is
104 designated as the foreground or control window.
105
106 .getc_redirect
107 If the control window for DIALOG_STATE.getc_callbacks is closed, the
108 list is transferred to this variable. Closing all windows causes the
109 application to exit.
110
111 .had_resize
112 This is set to TRUE in dlg_will_resize or dlg_result_key when KEY_RE‐
113 SIZE is read, to tell dialog to ignore subsequent ERRs.
114
115 .no_mouse
116 This corresponds to the command-line option "--no-mouse". If true, di‐
117 alog will not initialize (and enable) the mouse in init_dialog.
118
119 .output
120 This is set in the dialog application to the stream on which the appli‐
121 cation and library functions may write text results. Normally that is
122 the standard error, since the curses library prefers to write its data
123 to the standard output. Some scripts, trading portability for conve‐
124 nience, prefer to write results to the standard output, e.g., by using
125 the "--stdout" option.
126
127 .output_count
128 This is incremented by dlg_does_output, which is called by each widget
129 that writes text to the output. The dialog application uses that to
130 decide if it should also write a separator, i.e., DIALOG_STATE.sepa‐
131 rate_str, between calls to each widget.
132
133 .pipe_input
134 This is set in init_dialog to a stream which can be used by the gauge
135 widget, which must be the application's standard input. The dialog ap‐
136 plication calls init_dialog normally with input set to the standard in‐
137 put, but optionally based on the "--input-fd" option. Since the appli‐
138 cation cannot read from a pipe (standard input) and at the same time
139 read the curses input from the standard input, it must allow for re‐
140 opening the latter from either a specific file descriptor, or directly
141 from the terminal. The adjusted pipe stream value is stored in this
142 variable.
143
144 .screen_height
145 The text-formatting functions use this for the number of rows used for
146 formatting a string.
147
148 It is used by dialog for the command-line options "--print-text-size"
149 and "--print-text-only".
150
151 .screen_initialized
152 This is set in init_dialog and reset in end_dialog. It is used to
153 check if curses has been initialized, and if the endwin function must
154 be called on exit.
155
156 .screen_output
157 This is set in init_dialog to the output stream used by the curses li‐
158 brary. Normally that is the standard output, unless that happens to
159 not be a terminal (and if init_dialog can successfully open the termi‐
160 nal directly).
161
162 .screen_width
163 The text-formatting functions use this for the number of columns used
164 for formatting a string.
165
166 It is used by dialog for the command-line options "--print-text-size"
167 and "--print-text-only".
168
169 .separate_str
170 This corresponds to the command-line option "--separate-widget". The
171 given string specifies a string that will separate the output on dia‐
172 log's output from each widget. This is used to simplify parsing the
173 result of a dialog with several widgets. If this option is not given,
174 the default separator string is a tab character.
175
176 .tab_len
177 This corresponds to the command-line option "--tab-len number". Spec‐
178 ify the number of spaces that a tab character occupies if the
179 "--tab-correct" option is given. The default is 8.
180
181 .text_height
182 The text-formatting functions set this to the number of lines used for
183 formatting a string.
184
185 It is used by dialog for the command-line options "--print-text-size"
186 and "--print-text-only".
187
188 .text_only
189 Dialog uses this in the command-line option "--print-text-only".
190
191 The text-formatting functions (dlg_print_text, dlg_print_line, and
192 dlg_print_autowrap) check this to decide whether to print the formatted
193 text to dialog's output or to the curses-display.
194
195 Also, dlg_auto_size checks the flag, allowing it to be used before
196 init_dialog is called.
197
198 .text_width
199 The text-formatting functions set this to the number of columns used
200 for formatting a string.
201
202 It is used by dialog for the command-line options "--print-text-size"
203 and "--print-text-only".
204
205 .trace_output
206 This corresponds to the command-line option "--trace file". It is the
207 file pointer to which trace messages are written.
208
209 .use_colors
210 This is set in init_dialog if the curses implementation supports color.
211
212 .use_scrollbar
213 This corresponds to the command-line option "--scrollbar". If true,
214 draw a scrollbar to make windows holding scrolled data more readable.
215
216 .use_shadow
217 This corresponds to the command-line option "--no-shadow". This is set
218 in init_dialog if the curses implementation supports color. If true,
219 suppress shadows that would be drawn to the right and bottom of each
220 dialog box.
221
222 .visit_items
223 This corresponds to the command-line option "--visit-items". Modify
224 the tab-traversal of the list-oriented widgets (buildlist, checklist,
225 radiobox, menubox, inputmenu, and treeview) to include the list of
226 items as one of the states. This is useful as a visual aid, i.e., the
227 cursor position helps some users.
228
229 The dialog application resets the dialog_vars data before accepting op‐
230 tions to invoke each widget. Most of the DIALOG_VARS members are set
231 directly from dialog's command-line options:
232
234 In contrast to DIALOG_STATE, the members of DIALOG_VARS are set by com‐
235 mand-line options in dialog.
236
237 .ascii_lines
238 This corresponds to the command-line option "--ascii-lines. It causes
239 line-drawing to be done with ASCII characters, e.g., "+" and "-". See
240 DIALOG_VARS.no_lines.
241
242 .backtitle
243 This corresponds to the command-line option "--backtitle backtitle".
244 It specifies a backtitle string to be displayed on the backdrop, at the
245 top of the screen.
246
247 .beep_after_signal
248 This corresponds to the command-line option "--beep-after". If true,
249 beep after a user has completed a widget by pressing one of the but‐
250 tons.
251
252 .beep_signal
253 This corresponds to the command-line option "--beep". It is obsolete.
254
255 .begin_set
256 This is true if the command-line option "--begin y x" was used. It
257 specifies the position of the upper left corner of a dialog box on the
258 screen.
259
260 .begin_x
261 This corresponds to the x value from the command-line option "--begin y
262 x" (second value).
263
264 .begin_y
265 This corresponds to the y value from the command-line option "--begin y
266 x" (first value).
267
268 .cancel_label
269 This corresponds to the command-line option "--cancel-label string".
270 The given string overrides the label used for “Cancel” buttons.
271
272 .cant_kill
273 This corresponds to the command-line option "--no-kill". If true, this
274 tells dialog to put the tailboxbg box in the background, printing its
275 process id to dialog's output. SIGHUP is disabled for the background
276 process.
277
278 .colors
279 This corresponds to the command-line option "--colors". If true, in‐
280 terpret embedded "\Z" sequences in the dialog text by the following
281 character, which tells dialog to set colors or video attributes: 0
282 through 7 are the ANSI codes used in curses: black, red, green, yellow,
283 blue, magenta, cyan and white respectively. Bold is set by 'b', reset
284 by 'B'. Reverse is set by 'r', reset by 'R'. Underline is set by 'u',
285 reset by 'U'. The settings are cumulative, e.g., "\Zb\Z1" makes the
286 following text bright red. Restore normal settings with "\Zn".
287
288 .column_separator
289 This corresponds to the command-line option "--column-separator". Dia‐
290 log splits data for radio/checkboxes and menus on the occurrences of
291 the given string, and aligns the split data into columns.
292
293 .cr_wrap
294 This corresponds to the command-line option "--cr-wrap". If true, in‐
295 terpret embedded newlines in the dialog text as a newline on the
296 screen. Otherwise, dialog will only wrap lines where needed to fit in‐
297 side the text box. Even though you can control line breaks with this,
298 dialog will still wrap any lines that are too long for the width of the
299 box. Without cr-wrap, the layout of your text may be formatted to look
300 nice in the source code of your script without affecting the way it
301 will look in the dialog.
302
303 .cursor_off_label
304 This corresponds to the command-line option "--cursor-off-label". If
305 true, place the terminal cursor at the end of a button instead of on
306 the first character of the button label. This is useful to reduce vis‐
307 ual confusion when the cursor coloration interacts poorly with the but‐
308 ton-label text colors.
309
310 .date_format
311 This corresponds to the command-line option "--date-format string". If
312 the host provides strftime, and the value is nonnull, the calendar wid‐
313 get uses this to format its output.
314
315 .default_button
316 This is set by the command-line option "--default-button. It is used
317 by dlg_default_button.
318
319 .default_item
320 This corresponds to the command-line option "--default-item string".
321 The given string is used as the default item in a checklist, form or
322 menu box. Normally the first item in the box is the default.
323
324 .defaultno
325 This corresponds to the command-line option "--defaultno". If true,
326 make the default value of the yes/no box a No. Likewise, treat the de‐
327 fault button of widgets that provide “OK” and “Cancel” as a Cancel. If
328 --no-cancel was given that option overrides this, making the default
329 button always “Yes” (internally the same as “OK”).
330
331 .dlg_clear_screen
332 This corresponds to the command-line option "--clear". This option is
333 implemented in the main program, not the library. If true, the screen
334 will be cleared on exit. This may be used alone, without other op‐
335 tions.
336
337 .erase_on_exit
338 This corresponds to the command-line option "--erase-on-exit". If
339 true, remove the dialog widget on program exit, erasing the entire
340 screen to its native background color, and place the terminal cursor at
341 the lower left corner of the screen. This is useful for making the
342 window contents invisible at the end of a series of dialog boxes. But
343 it can also be used at earlier stages of a series of invocations of di‐
344 alog, if the series may be aborted before it is fully completed.
345
346 .exit_label
347 This corresponds to the command-line option "--exit-label string". The
348 given string overrides the label used for “EXIT” buttons.
349
350 .extra_button
351 This corresponds to the command-line option "--extra-button". If true,
352 some widgets show an extra button, between “OK” and “Cancel” buttons.
353
354 .extra_label
355 This corresponds to the command-line option "--extra-label string".
356 The given string overrides the label used for “Extra” buttons. Note:
357 for inputmenu widgets, this defaults to “Rename”.
358
359 .formitem_type
360 This is set by the command-line option "--passwordform" to tell the
361 form widget that its text fields should be treated like password wid‐
362 gets.
363
364 .help_button
365 This corresponds to the command-line option "--help-button". If true,
366 some widgets show a help-button after “OK” and “Cancel” buttons, i.e.,
367 in checklist, radiolist and menu boxes. If --item-help is also given,
368 on exit the return status will be the same as for the “OK” button, and
369 the item-help text will be written to dialog's output after the token
370 “HELP”. Otherwise, the return status will indicate that the Help but‐
371 ton was pressed, and no message printed.
372
373 .help_file
374 This corresponds to the command-line option "--hfile string". The
375 given filename is passed to dialog_helpfile when the user presses F1.
376
377 .help_label
378 This corresponds to the command-line option "--help-label string". The
379 given string overrides the label used for “Help” buttons.
380
381 .help_line
382 This corresponds to the command-line option "--hline string". The
383 given string is displayed in the bottom of dialog windows, like a sub‐
384 title.
385
386 .help_status
387 This corresponds to the command-line option "--help-status". If true,
388 and the the help-button is selected, writes the checklist or radiolist
389 information after the item-help “HELP” information. This can be used
390 to reconstruct the state of a checklist after processing the help re‐
391 quest.
392
393 .help_tags
394 This corresponds to the command-line option "--help-tags". If true,
395 dlg_add_help_formitem and dlg_add_help_listitem use the item's tag
396 value consistently rather than using the tag's help-text value when DI‐
397 ALOG_VARS.item_help is set.
398
399 .input_length
400 This is nonzero if DIALOG_VARS.input_result is allocated, versus being
401 a pointer to the user's local variables.
402
403 .input_menu
404 This flag is set to denote whether the menubox widget implements a menu
405 versus a inputmenu widget.
406
407 .input_result
408 This may be either a user-supplied buffer, or a buffer dynamically al‐
409 located by the library, depending on DIALOG_VARS.input_length:
410
411 • If DIALOG_VARS.input_length is zero, this is a pointer to user buf‐
412 fer (on the stack, or static). The buffer size is assumed to be
413 MAX_LEN, which is defined in <dialog.h>.
414
415 • When DIALOG_VARS.input_length is nonzero, this is a dynamically-al‐
416 located buffer used by the widgets to return printable results to
417 the calling application.
418
419 Certain widgets copy a result to this buffer. If the pointer is NULL,
420 or if the length is insufficient for the result, then the dialog li‐
421 brary allocates a buffer which is large enough, and sets DIA‐
422 LOG_VARS.input_length. Callers should check for this case if they have
423 supplied their own buffer.
424
425 .insecure
426 This corresponds to the command-line option "--insecure". If true,
427 make the password widget friendlier but less secure, by echoing aster‐
428 isks for each character.
429
430 .in_helpfile
431 This variable is used to prevent dialog_helpfile from showing anything,
432 e.g., if F1 were pressed within a help-file display.
433
434 .iso_week
435 This corresponds to the command-line option "--iso-week". It is used
436 in the calendar widget to tell how to compute the starting week for the
437 year:
438
439 • by default, the calendar treats January 1 as the first week of the
440 year.
441
442 • If this variable is true, the calendar uses ISO 8601's convention.
443 ISO 8601 numbers weeks starting with the first week in January with
444 a Thursday in the current year. January 1 may be in the previous
445 year.
446
447 .item_help
448 This corresponds to the command-line option "--item-help". If true,
449 interpret the tags data for checklist, radiolist and menu boxes adding
450 a column whose text is displayed in the bottom line of the screen, for
451 the currently selected item.
452
453 .keep_tite
454 This is set by the command-line option "--keep-tite" to tell dialog to
455 not attempt to cancel the terminal initialization (termcap ti/te) se‐
456 quences which correspond to xterm's alternate-screen switching. Nor‐
457 mally dialog does this to avoid flickering when run several times in a
458 script.
459
460 .keep_window
461 This corresponds to the command-line option "--keep-window". If true,
462 do not remove/repaint the window on exit. This is useful for keeping
463 the window contents visible when several widgets are run in the same
464 process. Note that curses will clear the screen when starting a new
465 process.
466
467 .last_key
468 This corresponds to the command-line option "--last-key".
469
470 .max_input
471 This corresponds to the command-line option "--max-input size". Limit
472 input strings to the given size. If not specified, the limit is 2048.
473
474 .no_hot_key
475 This corresponds to the command-line option "--no-hot-list".
476
477 Some widgets (buildlist, checklist, inputmenu, menu, radiolist, tree‐
478 view) display a list for which the leading capital letter in each entry
479 is accepted as a hot-key, to quickly move the focus to that entry.
480
481 Setting this variable to TRUE disables the feature.
482
483 .no_items
484 This corresponds to the command-line option "--no-items". Some widgets
485 (checklist, inputmenu, radiolist, menu) display a list with two columns
486 (a “tag” and “item”, i.e., “description”). This tells dialog to read
487 shorter rows from data, omitting the “list”.
488
489 .no_label
490 This corresponds to the command-line option "--no-label string". The
491 given string overrides the label used for “No” buttons.
492
493 .no_lines
494 This corresponds to the command-line option "--no-lines. It suppresses
495 line-drawing. See DIALOG_VARS.ascii_lines.
496
497 .no_nl_expand
498 This corresponds to the command-line option "--no-nl-expand". If
499 false, dlg_trim_string converts literal "\n" substrings in a message
500 into newlines.
501
502 .no_tags
503 This corresponds to the command-line option "--no-tags". Some widgets
504 (checklist, inputmenu, radiolist, menu) display a list with two columns
505 (a “tag” and “item”, also known as “description”). The tag is useful
506 for scripting, but may not help the user. The --no-tags option (from
507 Xdialog) may be used to suppress the column of tags from the display.
508
509 Normally dialog allows you to quickly move to entries on the displayed
510 list, by matching a single character to the first character of the tag.
511 When the --no-tags option is given, dialog matches against the first
512 character of the description. In either case, the matchable character
513 is highlighted.
514
515 Here is a table showing how the no_tags and no_items values interact:
516
517 Widget Fields Shown Fields Read .no_items .no_tags
518 ──────────────────────────────────────────────────────────────
519 buildlist item tag,item 0 0*
520 buildlist item tag,item 0 1
521 buildlist tag tag 1 0*
522 buildlist tag tag 1 1
523 checklist tag,item tag,item 0 0
524 checklist item tag,item 0 1
525 checklist tag tag 1 0
526 checklist tag tag 1 1
527 inputmenu tag,item tag,item 0 0
528 inputmenu item tag,item 0 1
529 inputmenu tag tag 1 0
530 inputmenu tag tag 1 1
531 menu tag,item tag,item 0 0
532 menu item tag,item 0 1
533 menu tag tag 1 0
534 menu tag tag 1 1
535 radiolist tag,item tag,item 0 0
536 radiolist item tag,item 0 1
537 radiolist tag tag 1 0
538 radiolist tag tag 1 1
539 treeview item tag,item 0 0*
540 treeview item tag,item 0 1
541 treeview tag tag 1 0*
542 treeview tag tag 1 1
543 ──────────────────────────────────────────────────────────────
544
545 * Xdialog does not display the tag column for the analogous buildlist
546 and treeview widgets. Dialog does the same on the command-line.
547 However the library interface defaults to displaying the tag column.
548 Your application can enable or disable the tag column as needed for
549 each widget.
550
551 .nocancel
552 This corresponds to the command-line option "--no-cancel". If true,
553 suppress the “Cancel” button in checklist, inputbox and menu box modes.
554 A script can still test if the user pressed the ESC key to cancel to
555 quit.
556
557 .nocollapse
558 This corresponds to the command-line option "--no-collapse". Normally
559 dialog converts tabs to spaces and reduces multiple spaces to a single
560 space for text which is displayed in a message boxes, etc. It true,
561 that feature is disabled. Note that dialog will still wrap text, sub‐
562 ject to the --cr-wrap option.
563
564 .nook
565 This corresponds to the command-line option "--no-ok. Dialog will sup‐
566 press the “ok” (or “yes”) button from the widget.
567
568 .ok_label
569 This corresponds to the command-line option "--ok-label string". The
570 given string overrides the label used for “OK” buttons.
571
572 .pause_secs
573 When set, force dlg_set_timeout to use 10 milliseconds rather than us‐
574 ing the DIALOG_VARS.timeout_secs value.
575
576 .print_siz
577 This corresponds to the command-line option "--print-size". If true,
578 each widget prints its size to dialog's output when it is invoked.
579
580 .quoted
581 This corresponds to the command-line option "--quoted. Normally dialog
582 quotes the strings returned by checklist's as well as the item-help
583 text. If true, dialog will quote all string results.
584
585 .reorder
586 This corresponds to the command-line option "--reorder. By default,
587 the buildlist widget uses the same order for the output (right) list as
588 for the input (left). If true, dialog will use the order in which a
589 user adds selections to the output list.
590
591 .separate_output
592 This corresponds to the command-line option "--separate-output". If
593 true, checklist widgets output result one line at a time, with no quot‐
594 ing. This facilitates parsing by another program.
595
596 .single_quoted
597 This corresponds to the command-line option "--single-quoted". If
598 true, use single-quoting as needed (and no quotes if unneeded) for the
599 output of checklist's as well as the item-help text. If this option is
600 not set, dialog uses double quotes around each item. The latter re‐
601 quires occasional use of backslashes to make the output useful in shell
602 scripts.
603
604 .size_err
605 This corresponds to the command-line option "--size-err". If true,
606 check the resulting size of a dialog box before trying to use it,
607 printing the resulting size if it is larger than the screen. (This op‐
608 tion is obsolete, since all new-window calls are checked).
609
610 .sleep_secs
611 This corresponds to the command-line option "--sleep secs". This op‐
612 tion is implemented in the main program, not the library. If nonzero,
613 this is the number of seconds after to delay after processing a dialog
614 box.
615
616 .tab_correct
617 This corresponds to the command-line option "--tab-correct". If true,
618 convert each tab character of the text to one or more spaces. Other‐
619 wise, tabs are rendered according to the curses library's interpreta‐
620 tion.
621
622 .time_format
623 This corresponds to the command-line option "--time-format string". If
624 the host provides strftime, and the value is nonnull, the timebox wid‐
625 get uses this to format its output.
626
627 .timeout_secs
628 This corresponds to the command-line option "--timeout secs". If non‐
629 zero, timeout input requests (exit with error code) if no user response
630 within the given number of seconds.
631
632 .title
633 This corresponds to the command-line option "--title title". Specifies
634 a title string to be displayed at the top of the dialog box.
635
636 .trim_whitespace
637 This corresponds to the command-line option "--trim". If true, elimi‐
638 nate leading blanks, trim literal newlines and repeated blanks from
639 message text.
640
641 .week_start
642 This corresponds to the command-line option "--week-start". It is used
643 in the calendar widget to set the starting day for the week. The
644 string value can be
645
646 • a number (0 to 6, Sunday through Saturday using POSIX) or
647
648 • the special value “locale” (this works with systems using glibc,
649 providing an extension to the locale command, the first_weekday
650 value).
651
652 • a string matching one of the abbreviations for the day of the week
653 shown in the calendar widget, e.g., “Mo” for “Monday”.
654
655 .yes_label
656 This corresponds to the command-line option "--yes-label string". The
657 given string overrides the label used for “Yes” buttons.
658
660 Functions that implement major functionality for the command-line dia‐
661 log program, e.g., widgets, have names beginning "dialog_".
662
663 All dialog boxes have at least three parameters:
664
665 title
666 the caption for the box, shown on its top border.
667
668 height
669 the height of the dialog box.
670
671 width
672 the width of the dialog box.
673
674 Other parameters depend on the box type.
675
676 dialog_buildlist
677 implements the "--buildlist" option.
678
679 const char * title
680 is the title on the top of the widget.
681
682 const char * cprompt
683 is the prompt text shown within the widget.
684
685 int height
686 is the desired height of the box. If zero, the height is adjusted
687 to use the available screen size.
688
689 int width
690 is the desired width of the box. If zero, the height is adjusted
691 to use the available screen size.
692
693 int list_height
694 is the minimum height to reserve for displaying the list. If
695 zero, it is computed based on the given height and width.
696
697 int item_no
698 is the number of rows in items.
699
700 char ** items
701 is an array of strings which is viewed either as a list of rows
702 tag item status
703
704 or
705 tag item status help
706
707 depending on whether dialog_vars.item_help is set.
708
709 int order_mode
710 is reserved for future enhancements
711
712 dialog_calendar
713 implements the "--calendar" option.
714
715 const char * title
716 is the title on the top of the widget.
717
718 const char * subtitle
719 is the prompt text shown within the widget.
720
721 int height
722 is the height excluding the fixed-height calendar grid.
723
724 int width
725 is the overall width of the box, which is adjusted up to the cal‐
726 endar grid's minimum width if needed.
727
728 int day
729 is the initial day of the week shown, counting zero as Sunday. If
730 the value is negative, the current day of the week is used.
731
732 int month
733 is the initial month of the year shown, counting one as January.
734 If the value is negative, the current month of the year is used.
735
736 int year
737 is the initial year shown. If the value is negative, the current
738 year is used.
739
740 dialog_checklist
741 implements the "--checklist" and "--radiolist" options depending on the
742 flag parameter.
743
744 const char * title
745 is the title on the top of the widget.
746
747 const char * cprompt
748 is the prompt text shown within the widget.
749
750 int height
751 is the desired height of the box. If zero, the height is adjusted
752 to use the available screen size.
753
754 int width
755 is the desired width of the box. If zero, the height is adjusted
756 to use the available screen size.
757
758 int list_height
759 is the minimum height to reserve for displaying the list. If
760 zero, it is computed based on the given height and width.
761
762 int item_no
763 is the number of rows in items.
764
765 int items
766 is an array of strings which is viewed either as a list of rows
767 tag item status
768
769 or
770 tag item status help
771
772 depending on whether dialog_vars.item_help is set.
773
774 flag is either FLAG_CHECK, for checklists, or FLAG_RADIO for radi‐
775 olists.
776
777 dialog_dselect
778 implements the "--dselect" option.
779
780 const char * title
781 is the title on the top of the widget.
782
783 const char * path
784 is the preselected value to show in the input-box, which is used
785 also to set the directory- and file-windows.
786
787 int height
788 is the height excluding the minimum needed to show the dialog box
789 framework. If zero, the height is based on the screen size.
790
791 int width
792 is the desired width of the box. If zero, the height is based on
793 the screen size.
794
795 dialog_editbox
796 implements the "--editbox" option.
797
798 const char * title
799 is the title on the top of the widget.
800
801 const char * file
802 is the name of the file from which to read.
803
804 int height
805 is the desired height of the box. If zero, the height is adjusted
806 to use the available screen size.
807
808 int width
809 is the desired width of the box. If zero, the height is adjusted
810 to use the available screen size.
811
812 dialog_form
813 implements the "--form" option.
814
815 const char * title
816 is the title on the top of the widget.
817
818 const char * cprompt
819 is the prompt text shown within the widget.
820
821 int height
822 is the desired height of the box. If zero, the height is adjusted
823 to use the available screen size.
824
825 int width
826 is the desired width of the box. If zero, the height is adjusted
827 to use the available screen size.
828
829 int form_height
830 is the minimum height to reserve for displaying the list. If
831 zero, it is computed based on the given height and width.
832
833 int item_no
834 is the number of rows in items.
835
836 int items
837 is an array of strings which is viewed either as a list of rows
838 Name NameY NameX Text TextY TextX FLen ILen
839
840 or
841 Name NameY NameX Text TextY TextX FLen ILen Help
842
843 depending on whether dialog_vars.item_help is set.
844
845 dialog_fselect
846 implements the "--fselect" option.
847
848 const char * title
849 is the title on the top of the widget.
850
851 const char * path
852 is the preselected value to show in the input-box, which is used
853 also to set the directory- and file-windows.
854
855 int height
856 is the height excluding the minimum needed to show the dialog box
857 framework. If zero, the height is based on the screen size.
858
859 int width
860 is the desired width of the box. If zero, the height is based on
861 the screen size.
862
863 dialog_gauge
864 implements the "--gauge" option. Alternatively, a simpler or custom‐
865 ized gauge widget can be set up using dlg_allocate_gauge, dlg_reallo‐
866 cate_gauge, dlg_update_gauge and dlg_free_gauge.
867
868 const char * title
869 is the title on the top of the widget.
870
871 const char * cprompt
872 is the prompt text shown within the widget.
873
874 int height
875 is the desired height of the box. If zero, the height is based on
876 the screen size.
877
878 int width
879 is the desired width of the box. If zero, the height is based on
880 the screen size.
881
882 int percent
883 is the percentage to show in the progress bar.
884
885 dialog_inputbox
886 implements the "--inputbox" or "--password" option, depending on the
887 value of password.
888
889 const char * title
890 is the title on the top of the widget.
891
892 const char * cprompt
893 is the prompt text shown within the widget.
894
895 int height
896 is the desired height of the box. If zero, the height is based on
897 the screen size.
898
899 int width
900 is the desired width of the box. If zero, the height is based on
901 the screen size.
902
903 const char * init
904 is the initial value of the input box, whose length is taken into
905 account when auto-sizing the width of the dialog box.
906
907 int password
908 if true, causes typed input to be echoed as asterisks.
909
910 dialog_helpfile
911 implements the "--hfile" option.
912
913 const char * title
914 is the title on the top of the widget.
915
916 const char * file
917 is the name of a file containing the text to display. This func‐
918 tion is internally bound to F1 (function key “1”), passing dia‐
919 log_vars.help_file as a parameter. The dialog program sets that
920 variable when the --hfile option is given.
921
922 int height
923 is the desired height of the box. If zero, the height is based on
924 the screen size.
925
926 int width
927 is the desired width of the box. If zero, the height is based on
928 the screen size.
929
930 dialog_menu
931 implements the "--menu" or "--inputmenu" option depending on whether
932 dialog_vars.input_menu is set.
933
934 const char * title
935 is the title on the top of the widget.
936
937 const char * cprompt
938 is the prompt text shown within the widget.
939
940 int height
941 is the desired height of the box. If zero, the height is based on
942 the screen size.
943
944 int width
945 is the desired width of the box. If zero, the height is based on
946 the screen size.
947
948 int menu_height
949 is the minimum height to reserve for displaying the list. If
950 zero, it is computed based on the given height and width.
951
952 int item_no
953 is the number of rows in items.
954
955 int items
956 is an array of strings which is viewed either as a list of rows
957 tag item
958
959 or
960 tag item help
961
962 depending on whether dialog_vars.item_help is set.
963
964 dialog_mixedform
965 implements the "--mixedform" option.
966
967 const char * title
968 is the title on the top of the widget.
969
970 const char * cprompt
971 is the prompt text shown within the widget.
972
973 int height
974 is the desired height of the box. If zero, the height is adjusted
975 to use the available screen size.
976
977 int width
978 is the desired width of the box. If zero, the height is adjusted
979 to use the available screen size.
980
981 int form_height
982 is the minimum height to reserve for displaying the list. If
983 zero, it is computed based on the given height and width.
984
985 int item_no
986 is the number of rows in items.
987
988 int items
989 is an array of strings which is viewed either as a list of rows
990 Name NameY NameX Text TextY TextX FLen ILen Ityp
991
992 or
993 Name NameY NameX Text TextY TextX FLen ILen Ityp Help
994
995 depending on whether dialog_vars.item_help is set.
996
997 dialog_mixedgauge
998 implements the "--mixedgauge" option
999
1000 const char * title
1001 is the title on the top of the widget.
1002
1003 const char * cprompt
1004 is the caption text shown within the widget.
1005
1006 int height
1007 is the desired height of the box. If zero, the height is based on
1008 the screen size.
1009
1010 int width
1011 is the desired width of the box. If zero, the height is based on
1012 the screen size.
1013
1014 int percent
1015 is the percentage to show in the progress bar.
1016
1017 int item_no
1018 is the number of rows in items.
1019
1020 int items
1021 is an array of strings which is viewed as a list of tag and item
1022 values. The tag values are listed, one per row, in the list at
1023 the top of the widget.
1024
1025 The item values are decoded: digits 0 through 9 are the following
1026 strings
1027
1028 0 Succeeded
1029
1030 1 Failed
1031
1032 2 Passed
1033
1034 3 Completed
1035
1036 4 Checked
1037
1038 5 Done
1039
1040 6 Skipped
1041
1042 7 In Progress
1043
1044 8 (blank)
1045
1046 9 N/A
1047
1048 A string with a leading "-" character is centered, marked with
1049 "%". For example, "-75" is displayed as "75%". Other strings are
1050 displayed as is.
1051
1052 dialog_msgbox
1053 implements the "--msgbox" or "--infobox" option depending on whether
1054 pauseopt is set.
1055
1056 const char * title
1057 is the title on the top of the widget.
1058
1059 const char * cprompt
1060 is the prompt text shown within the widget.
1061
1062 int height
1063 is the desired height of the box. If zero, the height is based on
1064 the screen size.
1065
1066 int width
1067 is the desired width of the box. If zero, the height is based on
1068 the screen size.
1069
1070 int pauseopt
1071 if true, an “OK” button will be shown, and the dialog will wait
1072 for it to complete. With an “OK” button, it is denoted a “msg‐
1073 box”, without an “OK” button, it is denoted an “infobox”.
1074
1075 dialog_pause
1076 implements the "--pause" option.
1077
1078 const char * title
1079 is the title on the top of the widget.
1080
1081 int height
1082 is the desired height of the box. If zero, the height is based on
1083 the screen size.
1084
1085 int width
1086 is the desired width of the box. If zero, the height is based on
1087 the screen size.
1088
1089 int seconds
1090 is the timeout to use for the progress bar.
1091
1092 dialog_prgbox
1093 implements the "--prgbox" option.
1094
1095 const char * title
1096 is the title on the top of the widget.
1097
1098 const char * cprompt
1099 is the prompt text shown within the widget. If empty or null, no
1100 prompt is shown.
1101
1102 const char * command
1103 is the name of the command to execute.
1104
1105 int height
1106 is the desired height of the box. If zero, the height is based on
1107 the screen size.
1108
1109 int width
1110 is the desired width of the box. If zero, the height is based on
1111 the screen size.
1112
1113 int pauseopt
1114 if true, an “OK” button will be shown, and the dialog will wait
1115 for it to complete.
1116
1117 dialog_progressbox
1118 implements the "--progressbox" option.
1119
1120 const char * title
1121 is the title on the top of the widget.
1122
1123 const char * cprompt
1124 is the prompt text shown within the widget. If empty or null, no
1125 prompt is shown.
1126
1127 int height
1128 is the desired height of the box. If zero, the height is based on
1129 the screen size.
1130
1131 int width
1132 is the desired width of the box. If zero, the height is based on
1133 the screen size.
1134
1135 dialog_rangebox
1136 implements the "--rangebox" option.
1137
1138 const char * title
1139 is the title on the top of the widget.
1140
1141 const char * cprompt
1142 is the prompt text shown within the widget. If empty or null, no
1143 prompt is shown.
1144
1145 int height
1146 is the desired height of the widget. If zero, the height is based
1147 on the screen size.
1148
1149 int width
1150 is the desired width of the widget. If zero, the height is based
1151 on the screen size.
1152
1153 int min_value
1154 is the minimum value to allow.
1155
1156 int max_value
1157 is the maximum value to allow.
1158
1159 int default_value
1160 is the default value, if no change is made.
1161
1162 dialog_tailbox
1163 implements the "--tailbox" or "--tailboxbg" option depending on whether
1164 bg_task is set.
1165
1166 const char * title
1167 is the title on the top of the widget.
1168
1169 const char * file
1170 is the name of the file to display in the dialog.
1171
1172 int height
1173 is the desired height of the box. If zero, the height is based on
1174 the screen size.
1175
1176 int width
1177 is the desired width of the box. If zero, the height is based on
1178 the screen size.
1179
1180 int bg_task
1181 if true, the window is added to the callback list in dialog_state,
1182 and the application will poll for the window to be updated. Oth‐
1183 erwise an “OK” button is added to the window, and it will be
1184 closed when the button is activated.
1185
1186 dialog_textbox
1187 implements the "--textbox" option.
1188
1189 const char * title
1190 is the title on the top of the widget.
1191
1192 const char * file
1193 is the name of the file to display in the dialog.
1194
1195 int height
1196 is the desired height of the box. If zero, the height is based on
1197 the screen size.
1198
1199 int width
1200 is the desired width of the box. If zero, the height is based on
1201 the screen size.
1202
1203 dialog_timebox
1204 implements the "--timebox" option. See dlg_auto_size for layout using
1205 height and width parameters.
1206
1207 const char * title
1208 is the title on the top of the widget.
1209
1210 const char * subtitle
1211 is the prompt text shown within the widget.
1212
1213 int height
1214 is the desired height of the box.
1215
1216 • If zero, the height is based on the screen size.
1217
1218 • If greater than zero, the requested height is added to the
1219 minimum box size.
1220
1221 int width
1222 is the desired width of the box.
1223
1224 • If zero, the height is based on the screen size.
1225
1226 • If greater than zero, the requested width is constrained by
1227 the minimum box size and the width of the buttons.
1228
1229 int hour
1230 is the initial hour shown. If the value is negative, the current
1231 hour is used. Returns DLG_EXIT_ERROR if the value specified is
1232 greater than or equal to 24.
1233
1234 int minute
1235 is the initial minute shown. If the value is negative, the cur‐
1236 rent minute is used. Returns DLG_EXIT_ERROR if the value speci‐
1237 fied is greater than or equal to 60.
1238
1239 int second
1240 is the initial second shown. If the value is negative, the cur‐
1241 rent second is used. Returns DLG_EXIT_ERROR if the value speci‐
1242 fied is greater than or equal to 60.
1243
1244 dialog_treeview
1245 implements the "--treeview" option.
1246
1247 const char * title
1248 is the title on the top of the widget.
1249
1250 const char * cprompt
1251 is the prompt text shown within the widget.
1252
1253 int height
1254 is the desired height of the box. If zero, the height is based on
1255 the screen size.
1256
1257 int width
1258 is the desired width of the box. If zero, the height is based on
1259 the screen size.
1260
1261 int list_height
1262 is the minimum height to reserve for displaying the list. If
1263 zero, it is computed based on the given height and width.
1264
1265 int item_no
1266 is the number of rows in items.
1267
1268 char ** items
1269 is the list of items, contain tag, name, and optionally help
1270 strings (if dialog_vars.item_help is set). The initial selection
1271 state for each item is also in this list.
1272
1273 int flag
1274
1275 flag is either FLAG_CHECK, for checklists (multiple selections), or
1276 FLAG_RADIO for radiolists (a single selection).
1277
1278 dialog_yesno
1279 implements the "--yesno" option.
1280
1281 const char * title
1282 is the title on the top of the widget.
1283
1284 const char * cprompt
1285 is the prompt text shown within the widget.
1286
1287 int height
1288 is the desired height of the box. If zero, the height is based on
1289 the screen size.
1290
1291 int width
1292 is the desired width of the box. If zero, the height is based on
1293 the screen size.
1294
1296 Most functions that implement lower-level functionality for the com‐
1297 mand-line dialog program or widgets, have names beginning "dlg_". Bow‐
1298 ing to longstanding usage, the functions that initialize the display
1299 and end it are named init_dialog and end_dialog.
1300
1301 The only non-widget function whose name begins with "dialog_" is dia‐
1302 log_version, which returns the version number of the library as a
1303 string.
1304
1305 A few functions are prefixed "_dlg_", because they are required for in‐
1306 ternal use, but not intended as part of the library application pro‐
1307 gramming interface.
1308
1309 Here is a brief summary of the utility functions and their parameters:
1310
1311 dlg_add_callback
1312 Add a callback, used to allow polling input from multiple tailbox wid‐
1313 gets.
1314
1315 DIALOG_CALLBACK *p
1316 contains the callback information.
1317
1318 dlg_add_callback_ref
1319 Like dlg_add_callback, but passes a reference to the DIALOG_CALLBACK as
1320 well as a pointer to a cleanup function which will be called when the
1321 associated input ends.
1322
1323 DIALOG_CALLBACK **p
1324 points to the callback information. This is a reference to the
1325 pointer so that the caller's pointer can be zeroed when input
1326 ends.
1327
1328 DIALOG_FREEBACK func
1329 function to call when input ends, e.g., to free caller's addi‐
1330 tional data.
1331
1332 dlg_add_help_formitem
1333 This is a utility function used enforce consistent behavior for the DI‐
1334 ALOG_VARS.help_tags and DIALOG_VARS.item_help variables.
1335
1336 int *result
1337 this is updated to DLG_EXIT_ITEM_HELP if DIALOG_VARS.item_help is
1338 set.
1339
1340 char **tag
1341 the tag- or help-text is stored here.
1342
1343 DIALOG_FORMITEM *item
1344 contains the list item to use for tag- or help-text.
1345
1346 dlg_add_help_listitem
1347 This is a utility function used enforce consistent behavior for the DI‐
1348 ALOG_VARS.help_tags and DIALOG_VARS.item_help variables.
1349
1350 int *result
1351 this is updated to DLG_EXIT_ITEM_HELP if DIALOG_VARS.item_help is
1352 set.
1353
1354 char **tag
1355 the tag- or help-text is stored here.
1356
1357 DIALOG_LISTITEM *item
1358 contains the list item to use for tag- or help-text.
1359
1360 dlg_add_last_key
1361 Report the last key entered by the user. This implements the
1362 --last-key command-line option, using dialog_vars.last_key.
1363
1364 int mode
1365 controls the way the last key report is separated from other re‐
1366 sults:
1367
1368 -2 (no separator)
1369
1370 -1 (separator after the key name)
1371
1372 0 (separator is optionally before the key name)
1373
1374 1 (same as -1)
1375
1376 dlg_add_quoted
1377 Add a quoted string to the result buffer (see dlg_add_result). If no
1378 quotes are necessary, none are used. If dialog_vars.single_quoted is
1379 set, single-quotes are used. Otherwise, double-quotes are used.
1380
1381 char * string
1382 is the string to add.
1383
1384 dlg_add_result
1385 Add a string to the result buffer dialog_vars.input_result.
1386
1387 char * string
1388 is the string to add.
1389
1390 dlg_add_separator
1391 Add an output-separator to the result buffer dialog_vars.input_result.
1392 If dialog_vars.output_separator is set, use that. Otherwise, if dia‐
1393 log_vars.separate_output is set, use newline. If neither is set, use a
1394 space.
1395
1396 dlg_add_string
1397 Add a quoted or unquoted string to the result buffer (see
1398 dlg_add_quoted) and dlg_add_result), according to whether dia‐
1399 log_vars.quoted is true.
1400
1401 char * string
1402 is the string to add.
1403
1404 dlg_align_columns
1405 Copy and reformat an array of pointers to strings, aligning according
1406 to the column separator dialog_vars.column_separator. If no column
1407 separator is set, the array will be unmodified; otherwise it is copied
1408 and reformatted.
1409
1410 Caveat: This function is only implemented for 8-bit characters.
1411
1412 char **target
1413 This is the array to reformat. It points to the first string to
1414 modify.
1415
1416 int per_row
1417 This is the size of the struct for each row of the array.
1418
1419 int num_rows
1420 This is the number of rows in the array.
1421
1422 dlg_allocate_gauge
1423 Allocates a gauge widget. Use dlg_update_gauge to display the result.
1424
1425 const char * title
1426 is the title string to display at the top of the widget.
1427
1428 const char * cprompt
1429 is the prompt text shown within the widget.
1430
1431 int height
1432 is the desired height of the box. If zero, the height is adjusted
1433 to use the available screen size.
1434
1435 int width
1436 is the desired width of the box. If zero, the height is adjusted
1437 to use the available screen size.
1438
1439 int percent
1440 is the percentage to show in the progress bar.
1441
1442 dlg_asciibox
1443 returns its parameter transformed to the corresponding "+" or "-",
1444 etc., for the line-drawing characters used in dialog. If the parameter
1445 is not a line-drawing or other special character such as ACS_DARROW, it
1446 returns 0.
1447
1448 chtype ch
1449 is the parameter, usually one of the ACS_xxx constants.
1450
1451 dlg_attr_clear
1452 Set window to the given attribute.
1453
1454 WINDOW * win
1455 is the window to update.
1456
1457 int height
1458 is the number of rows to update.
1459
1460 int width
1461 is the number of columns to update.
1462
1463 chtype attr
1464 is the attribute, e.g., A_BOLD.
1465
1466 dlg_auto_size
1467 Compute window size based on the size of the formatted prompt and mini‐
1468 mum dimensions for a given widget.
1469
1470 Dialog sets dialog_state.text_height and dialog_state.text_width for
1471 the formatted prompt as a side-effect.
1472
1473 Normally dialog writes the formatted prompt to the curses window, but
1474 it will write the formatted prompt to the output stream if dia‐
1475 log_state.text_only is set.
1476
1477 const char * title
1478 is the title string to display at the top of the widget.
1479
1480 const char * prompt
1481 is the message text which will be displayed in the widget, used
1482 here to determine how large the widget should be.
1483
1484 If the value is NULL, dialog allows the widget to use the whole
1485 screen, i.e., if the values referenced by height and/or width are
1486 zero.
1487
1488 int * height
1489 is the nominal height. Dialog checks the referenced value and may
1490 update it:
1491
1492 • if the value is negative, dialog updates it to the available
1493 height of the screen, after reserving rows for the window bor‐
1494 der and shadow, as well as taking into account dialog_vars.be‐
1495 gin_y and dialog_vars.begin_set.
1496
1497 • if the value is zero, dialog updates it to the required height
1498 of the window, taking into account a (possibly) multi-line
1499 prompt.
1500
1501 • if the value is greater than zero, dialog uses it internally,
1502 but restores the value on return.
1503
1504 int * width
1505 is the nominal width. Dialog checks the referenced value and may
1506 update it:
1507
1508 • if the value is negative, dialog updates it to the available
1509 width of the screen, after reserving rows for the window bor‐
1510 der and shadow, as well as taking into account dialog_vars.be‐
1511 gin_x and dialog_vars.begin_set.
1512
1513 • if the value is zero, dialog updates it to the required width
1514 of the window, taking into account a (possibly) multi-line
1515 prompt.
1516
1517 • if the value is greater than zero, dialog uses it internally,
1518 but restores the value on return.
1519
1520 int boxlines
1521 is the number of lines to reserve in the vertical direction.
1522
1523 int mincols
1524 is the minimum number of columns to use.
1525
1526 dlg_auto_sizefile
1527 Like dlg_auto_size, but use a file contents to decide how large the
1528 widget should be.
1529
1530 const char * title
1531 is the title string to display at the top of the widget.
1532
1533 const char * file
1534 is the name of the file.
1535
1536 int * height
1537 is the nominal height.
1538
1539 If it is -1, use the screen's height (after subtracting dia‐
1540 log_vars.begin_y if dialog_vars.begin_set is true).
1541
1542 If it is greater than zero, limit the referenced value to the
1543 screen-height after verifying that the file exists.
1544
1545 int * width
1546 is the nominal width.
1547
1548 If it is -1, use the screen's width (after subtracting dia‐
1549 log_vars.begin_x if dialog_vars.begin_set is true).
1550
1551 If it is greater than zero, limit the referenced value to the
1552 screen-width after verifying that the file exists.
1553
1554 int boxlines
1555 is the number of lines to reserve on the screen for drawing boxes.
1556
1557 int mincols
1558 is the number of columns to reserve on the screen for drawing
1559 boxes.
1560
1561 dlg_beeping
1562 If dialog_vars.beep_signal is nonzero, this calls beep once and sets
1563 dialog_vars.beep_signal to zero.
1564
1565 dlg_boxchar
1566 returns its chtype parameter transformed as follows:
1567
1568 • if neither dialog_vars.ascii_lines nor dialog_vars.no_lines is set.
1569
1570 • if dialog_vars.ascii_lines is set, returns the corresponding "+" or
1571 "-", etc., for the line-drawing characters used in dialog.
1572
1573 • otherwise, if dialog_vars.no_lines is set, returns a space for the
1574 line-drawing characters.
1575
1576 • if the parameter is not a line-drawing or other special character
1577 such as ACS_DARROW, it returns the parameter unchanged.
1578
1579 dlg_box_x_ordinate
1580 returns a suitable x-ordinate (column) for a new widget. If dia‐
1581 log_vars.begin_set is 1, use dialog_vars.begin_x; otherwise center the
1582 widget on the screen (using the width parameter).
1583
1584 int width
1585 is the width of the widget.
1586
1587 dlg_box_y_ordinate
1588 returns a suitable y-ordinate (row) for a new widget. If dia‐
1589 log_vars.begin_set is 1, use dialog_vars.begin_y; otherwise center the
1590 widget on the screen (using the height parameter).
1591
1592 int height
1593 is the height of the widget.
1594
1595 dlg_buildlist
1596 This is an alternate interface to the buildlist widget which allows the
1597 application to read the list item states back directly without putting
1598 them in the output buffer.
1599
1600 const char * title
1601 is the title string to display at the top of the widget.
1602
1603 const char * cprompt
1604 is the prompt text shown within the widget.
1605
1606 int height
1607 is the desired height of the box. If zero, the height is adjusted
1608 to use the available screen size.
1609
1610 int width
1611 is the desired width of the box. If zero, the height is adjusted
1612 to use the available screen size.
1613
1614 int list_height
1615 is the minimum height to reserve for displaying the list. If
1616 zero, it is computed based on the given height and width.
1617
1618 int item_no
1619 is the number of rows in items.
1620
1621 DIALOG_LISTITEM * items
1622 is the list of items, contain tag, name, and optionally help
1623 strings (if dialog_vars.item_help is set). The initial selection
1624 state for each item is also in this list.
1625
1626 const char * states
1627 This is a list of characters to display for the given states.
1628 Normally a buildlist provides true (1) and false (0) values, which
1629 the widget displays as "*" and space, respectively. An applica‐
1630 tion may set this parameter to an arbitrary null-terminated
1631 string. The widget determines the number of states from the
1632 length of this string, and will cycle through the corresponding
1633 display characters as the user presses the space-bar.
1634
1635 int order_mode
1636 is reserved for future enhancements
1637
1638 int * current_item
1639 The widget sets the referenced location to the index of the cur‐
1640 rent display item (cursor) when it returns.
1641
1642 dlg_button_count
1643 Count the buttons in the list.
1644
1645 const char ** labels
1646 is a list of (pointers to) button labels terminated by a null
1647 pointer.
1648
1649 dlg_button_key
1650 If a key was bound to one of the button-codes in dlg_result_key, fake a
1651 button-value and an “Cancel” key to cause the calling widget to return
1652 the corresponding status.
1653
1654 See dlg_ok_buttoncode, which maps settings for ok/extra/help and button
1655 number into exit-code.
1656
1657 dlg_button_layout
1658 Make sure there is enough space for the buttons by computing the width
1659 required for their labels, adding margins and limiting based on the
1660 screen size.
1661
1662 const char ** labels
1663 is a list of (pointers to) button labels terminated by a null
1664 pointer.
1665
1666 int * limit
1667 the function sets the referenced limit to the width required for
1668 the buttons (limited by the screen size) if that is wider than the
1669 passed-in limit.
1670
1671 dlg_button_sizes
1672 Compute the size of the button array in columns.
1673
1674 const char ** labels
1675 is a list of (pointers to) button labels terminated by a null
1676 pointer.
1677
1678 int vertical
1679 is true if the buttons are arranged in a column rather than a row.
1680
1681 int * longest
1682 Return the total number of columns in the referenced location.
1683
1684 int * length
1685 Return the longest button's columns in the referenced location.
1686
1687 dlg_button_to_char
1688 Find the first uppercase character in the label, which we may use for
1689 an abbreviation. If the label is empty, return -1. If no uppercase
1690 character is found, return 0. Otherwise return the uppercase charac‐
1691 ter.
1692
1693 Normally dlg_draw_buttons and dlg_char_to_button use the first upper‐
1694 case character. However, they keep track of all of the labels and if
1695 the first has already been used in another label, they will continue
1696 looking for another uppercase character. This function does not have
1697 enough information to make that check.
1698
1699 const char * label
1700 is the label to test.
1701
1702 dlg_button_x_step
1703 Compute the step-size needed between elements of the button array.
1704
1705 const char ** labels
1706 is a list of (pointers to) button labels terminated by a null
1707 pointer.
1708
1709 int limit
1710 is the maximum number of columns to allow for the buttons.
1711
1712 int * gap
1713 store the nominal gap between buttons in the referenced location.
1714 This is constrained to be at least one.
1715
1716 int * margin
1717 store the left+right total margins (for the list of buttons) in
1718 the referenced location.
1719
1720 int * step
1721 store the step-size in the referenced location.
1722
1723 dlg_calc_list_width
1724 Calculate the minimum width for the list, assuming none of the items
1725 are truncated.
1726
1727 int item_no
1728 is the number of items.
1729
1730 DIALOG_LISTITEM * items
1731 contains a name and text field, e.g., for checklists or radiobox
1732 lists. The function returns the sum of the widest columns needed
1733 for of each of these fields.
1734
1735 If dialog_vars.no_items is set, the text fields in the list are
1736 ignored.
1737
1738 dlg_calc_listh
1739 Calculate new height and list_height values.
1740
1741 int * height
1742 on input, is the height without adding the list-height. On re‐
1743 turn, this contains the total list-height and is the actual wid‐
1744 get's height.
1745
1746 int * list_height
1747 on input, is the requested list-height. On return, this contains
1748 the number of rows available for displaying the list after taking
1749 into account the screen size and the dialog_vars.begin_set and di‐
1750 alog_vars.begin_y variables.
1751
1752 int item_no
1753 is the number of items in the list.
1754
1755 dlg_calc_listw
1756 This function is obsolete, provided for library-compatibility. It is
1757 replaced by dlg_calc_list_width.
1758
1759 int item_no
1760 is the number of items.
1761
1762 char ** items
1763 is a list of character pointers.
1764
1765 int group
1766 is the number of items in each group, e.g., the second array in‐
1767 dex.
1768
1769 dlg_char_to_button
1770 Given a list of button labels, and a character which may be the abbre‐
1771 viation for one, find it, if it exists. An abbreviation will be the
1772 first character which happens to be capitalized in the label. If the
1773 character is found, return its index within the list of labels. Other‐
1774 wise, return DLG_EXIT_UNKNOWN.
1775
1776 int ch
1777 is the character to find.
1778
1779 const char ** labels
1780 is a list of (pointers to) button labels terminated by a null
1781 pointer.
1782
1783 dlg_checklist
1784 This entrypoint provides the --checklist or --radiolist functionality
1785 without the limitations of dialog's command-line syntax (compare to di‐
1786 alog_checklist).
1787
1788 const char * title
1789 is the title string to display at the top of the widget.
1790
1791 const char * cprompt
1792 is the prompt text shown within the widget.
1793
1794 int height
1795 is the desired height of the box. If zero, the height is adjusted
1796 to use the available screen size.
1797
1798 int width
1799 is the desired width of the box. If zero, the height is adjusted
1800 to use the available screen size.
1801
1802 int list_height
1803 is the minimum height to reserve for displaying the list. If
1804 zero, it is computed based on the given height and width.
1805
1806 int item_no
1807 is the number of items.
1808
1809 DIALOG_LISTITEM * items
1810 This is a list of the items to display in the checklist.
1811
1812 const char * states
1813 This is a list of characters to display for the given states.
1814 Normally a checklist provides true (1) and false (0) values, which
1815 the widget displays as "*" and space, respectively. An applica‐
1816 tion may set this parameter to an arbitrary null-terminated
1817 string. The widget determines the number of states from the
1818 length of this string, and will cycle through the corresponding
1819 display characters as the user presses the space-bar.
1820
1821 int flag
1822 This is should be one of FLAG_CHECK or FLAG_RADIO, depending on
1823 whether the widget should act as a checklist or radiobox.
1824
1825 int * current_item
1826 The widget sets the referenced location to the index of the cur‐
1827 rent display item (cursor) when it returns.
1828
1829 dlg_check_scrolled
1830 given a function key (or other key that was mapped to a function key),
1831 check if it is one of the up/down scrolling functions:
1832
1833 DLGK_PAGE_FIRST,
1834 DLGK_PAGE_LAST,
1835 DLGK_GRID_UP,
1836 DLGK_GRID_DOWN,
1837 DLGK_PAGE_PREV or
1838 DLGK_PAGE_NEXT.
1839
1840 Some widgets use these key bindings for scrolling the prompt-text up
1841 and down, to allow for display in very small windows.
1842
1843 The function returns 0 (zero) if it finds one of these keys, and -1 if
1844 not.
1845
1846 int key
1847 is the function-key to check
1848
1849 int last
1850 is the number of lines which would be used to display the scrolled
1851 prompt in an arbitrarily tall window. It is used here to check
1852 limits for the offset value.
1853
1854 int page
1855 this is the available height for writing scrolled text, which is
1856 smaller than the window if it contains buttons.
1857
1858 bool * show
1859 on return, holds TRUE if dlg_print_scrolled should be used to re‐
1860 display the prompt text.
1861
1862 int * offset
1863 on entry, holds the starting line number (counting from zero) last
1864 used for dlg_print_scrolled. On return, holds the updated start‐
1865 ing line number.
1866
1867 dlg_clear
1868 Set window to the default dialog screen attribute. This is set in the
1869 rc-file with screen_color.
1870
1871 dlg_clr_result
1872 Free storage used for the result buffer (dialog_vars.input_result).
1873 The corresponding pointer is set to NULL.
1874
1875 dlg_color_count
1876 Return the number of colors that can be configured in dialog.
1877
1878 dlg_color_setup
1879 Initialize the color pairs used in dialog.
1880
1881 dlg_count_argv
1882 Count the entries in an argument vector.
1883
1884 argv Points to the argument vector.
1885
1886 dlg_count_columns
1887 Returns the number of columns used for a string. This is not necessar‐
1888 ily the number of bytes in a string.
1889
1890 const char * string
1891 is the string to measure.
1892
1893 dlg_count_real_columns
1894 Returns the number of columns used for a string, accounting for "\Z"
1895 sequences which can be used for coloring the text if dialog_vars.colors
1896 is set. This is not necessarily the number of bytes in a string.
1897
1898 const char * string
1899 is the string to measure.
1900
1901 dlg_count_wchars
1902 Returns the number of wide-characters in the string.
1903
1904 const char * string
1905 is the string to measure.
1906
1907 dlg_create_rc
1908 Create a configuration file, i.e., write internal tables to a file
1909 which can be read back by dialog as an rc-file.
1910
1911 const char * filename
1912 is the name of the file to write to.
1913
1914 dlg_ctl_size
1915 If dialog_vars.size_err is true, check if the given window size is too
1916 large to fit on the screen. If so, exit with an error reporting the
1917 size of the window.
1918
1919 int height
1920 is the window's height
1921
1922 int width
1923 is the window's width
1924
1925 dlg_default_button
1926 If dialog_vars.default_button is positive, return the button-index for
1927 that button code, using dlg_ok_buttoncode to test indices starting with
1928 zero. Otherwise (or if no match was found for the button code), return
1929 zero.
1930
1931 dlg_default_formitem
1932 If dialog_vars.default_item is not null, find that name by matching the
1933 name field in the list of form items. If found, return the index of
1934 that item in the list. Otherwise, return zero.
1935
1936 DIALOG_FORMITEM * items
1937 is the list of items to search. It is terminated by an entry with
1938 a null name field.
1939
1940 dlg_default_item
1941 This function is obsolete, provided for library-compatibility. It is
1942 replaced by dlg_default_formitem and dlg_default_listitem.
1943
1944 char ** items
1945 is the list of items to search.
1946
1947 int llen
1948 is the number of items in each group, e.g., the second array in‐
1949 dex.
1950
1951 dlg_defaultno_button
1952 If dialog_vars.defaultno is true, and dialog_vars.nocancel is not, find
1953 the button-index for the “Cancel” button. Otherwise, return the index
1954 for “OK” (always zero).
1955
1956 dlg_del_window
1957 Remove a window, repainting everything else.
1958
1959 WINDOW * win
1960 is the window to remove.
1961
1962 dlg_der_window
1963 create a derived window, e.g., for an input area of a widget
1964
1965 WINDOW * win
1966 is the parent window
1967
1968 int height
1969 is the subwindow's height
1970
1971 int width
1972 is the subwindow's width
1973
1974 int y
1975 is the subwindow's top-row
1976
1977 int x
1978 is the subwindow's left-column
1979
1980 dlg_does_output
1981 This is called each time a widget is invoked which may do output. It
1982 increments dialog_state.output_count, so the output function in dialog
1983 can test this and add a separator.
1984
1985 dlg_draw_arrows
1986 Draw up/down arrows on a window, e.g., for scrollable lists. It calls
1987 dlg_draw_arrows2 using the menubox_color and menubox_border_color at‐
1988 tributes.
1989
1990 WINDOW * dialog
1991 is the window on which to draw an arrow.
1992
1993 int top_arrow
1994 is true if an up-arrow should be drawn at the top of the window.
1995
1996 int bottom_arrow
1997 is true if an down-arrow should be drawn at the bottom of the win‐
1998 dow.
1999
2000 int x
2001 is the zero-based column within the window on which to draw ar‐
2002 rows.
2003
2004 int top
2005 is the zero-based row within the window on which to draw up-arrows
2006 as well as a horizontal line to show the window's top.
2007
2008 int bottom
2009 is the zero-based row within the window on which to draw down-ar‐
2010 rows as well as a horizontal line to show the window's bottom.
2011
2012 dlg_draw_arrows2
2013 Draw up/down arrows on a window, e.g., for scrollable lists.
2014
2015 WINDOW * dialog
2016 is the window on which to draw an arrow.
2017
2018 int top_arrow
2019 is true if an up-arrow should be drawn at the top of the window.
2020
2021 int bottom_arrow
2022 is true if an down-arrow should be drawn at the bottom of the win‐
2023 dow.
2024
2025 int x
2026 is the zero-based column within the window on which to draw ar‐
2027 rows.
2028
2029 int top
2030 is the zero-based row within the window on which to draw up-arrows
2031 as well as a horizontal line to show the window's top.
2032
2033 int bottom
2034 is the zero-based row within the window on which to draw down-ar‐
2035 rows as well as a horizontal line to show the window's bottom.
2036
2037 chtype attr
2038 is the window's background attribute.
2039
2040 chtype borderattr
2041 is the window's border attribute.
2042
2043 dlg_draw_bottom_box
2044 Draw a partial box at the bottom of a window, e.g., to surround a row
2045 of buttons. It is designed to merge with an existing box around the
2046 whole window (see dlg_draw_box), so it uses tee-elements rather than
2047 corner-elements on the top corners of this box.
2048
2049 WINDOW * win
2050 is the window to update.
2051
2052 dlg_draw_bottom_box2
2053 Draw a partial box at the bottom of a window, e.g., to surround a row
2054 of buttons. It is designed to merge with an existing box around the
2055 whole window (see dlg_draw_box2), so it uses tee-elements rather than
2056 corner-elements on the top corners of this box.
2057
2058 WINDOW * win
2059 is the window to update.
2060
2061 chtype on_left
2062 is used to color the upper/left edges of the box, i.e., the tee-
2063 element and horizontal line
2064
2065 chtype on_right
2066 is used to color the right edge of the box, i.e., the tee-element
2067
2068 chtype on_inside
2069 is used to fill-color the inside of the box
2070
2071 dlg_draw_box
2072 Draw a rectangular box with line drawing characters.
2073
2074 WINDOW * win
2075 is the window to update.
2076
2077 int y
2078 is the top row of the box.
2079
2080 int x
2081 is the left column of the box.
2082
2083 int height
2084 is the height of the box.
2085
2086 int width
2087 is the width of the box.
2088
2089 chtype boxchar
2090 is used to color the right/lower edges. It also is fill-color
2091 used for the box contents.
2092
2093 chtype borderchar
2094 is used to color the upper/left edges.
2095
2096 dlg_draw_box2
2097 Draw a rectangular box with line drawing characters.
2098
2099 WINDOW * win
2100 is the window to update.
2101
2102 int y
2103 is the top row of the box.
2104
2105 int x
2106 is the left column of the box.
2107
2108 int height
2109 is the height of the box.
2110
2111 int width
2112 is the width of the box.
2113
2114 chtype boxchar
2115 is used to fill-color for the box contents.
2116
2117 chtype borderchar
2118 is used to color the upper/left edges.
2119
2120 chtype borderchar2
2121 is used to color the right/lower edges.
2122
2123 dlg_draw_buttons
2124 Print a list of buttons at the given position.
2125
2126 WINDOW * win
2127 is the window to update.
2128
2129 int y
2130 is the starting row.
2131
2132 int x
2133 is the starting column.
2134
2135 const char ** labels
2136 is a list of (pointers to) button labels terminated by a null
2137 pointer.
2138
2139 int selected
2140 is the index within the list of the selected button.
2141
2142 int vertical
2143 is true if the buttons are arranged in a column rather than a row.
2144
2145 int limit
2146 is the number of columns (or rows if vertical) allowed for the
2147 display.
2148
2149 dlg_draw_helpline
2150 draw the text in dialog_vars.help_line at the bottom of the given win‐
2151 dow.
2152
2153 WINDOW * dialog
2154 is the window to modify.
2155
2156 bool decorations
2157 if true, allow room for the scrolling arrows.
2158
2159 dlg_draw_scrollbar
2160 If dialog_state.use_scrollbar is set, draw a scrollbar on the right
2161 margin of windows holding scrollable data. Also (whether or not the
2162 scrollbar is drawn), annotate the bottom margin of the window with the
2163 percentage of data by the bottom of that window, and call dlg_draw_ar‐
2164 rows2 to put markers on the window showing when more data is available.
2165
2166 WINDOW * win
2167 is the window in which the data is scrolled. Because left, right,
2168 top, bottom are passed as parameters, this window can contain ad‐
2169 ditional data.
2170
2171 long first_data
2172 is the zero-based index to the first row of data in the current
2173 window.
2174
2175 long this_data
2176 is the zero-based index to the current row of data.
2177
2178 long next_data
2179 is the zero-based index to the next data after the current row.
2180
2181 long total_data
2182 is the total number of rows of data.
2183
2184 int left
2185 is the zero-based left margin/column of the window. The up/down
2186 arrows are draw inset by 5 columns from this point.
2187
2188 int right
2189 is the zero-based right margin/column of the window. The scroll‐
2190 bar is drawn flush against this column.
2191
2192 int top
2193 is the zero-based row within the window on which to draw up-arrows
2194 as well as a horizontal line to show the window's top.
2195
2196 int bottom
2197 is the zero-based row within the window on which to draw down-ar‐
2198 rows as well as a horizontal line to show the window's bottom.
2199
2200 chtype attr
2201 is the window's background attribute.
2202
2203 chtype borderattr
2204 is the window's border attribute.
2205
2206 dlg_draw_shadow
2207 Draw shadows along the right and bottom edge of a window to give it a
2208 3-dimensional look. (The height, etc., may not be the same as the win‐
2209 dow's actual values).
2210
2211 WINDOW * win
2212 is the window to update.
2213
2214 int height
2215 is the height of the window.
2216
2217 int width
2218 is the width of the window.
2219
2220 int y
2221 is the top row of the window.
2222
2223 int x
2224 is the left column of the window.
2225
2226 dlg_draw_title
2227 Draw a title centered at the top of the window.
2228
2229 WINDOW * win
2230 is the window to update.
2231
2232 const char * title
2233 is the title string to display at the top of the widget.
2234
2235 dlg_dummy_menutext
2236 This is a utility function which supports the --inputmenu option of the
2237 dialog program. If dialog_vars.input_menu is set, dialog_menu passes
2238 this pointer to dlg_menu as the rename_menutext parameter. Otherwise,
2239 it passes dlg_dummy_menutext.
2240
2241 The function should only return DLG_EXIT_ERROR.
2242
2243 DIALOG_LISTITEM * items
2244 is the list of menu items
2245
2246 int current
2247 is the index of the currently-selected item
2248
2249 char * newtext
2250 is the updated text for the menu item
2251
2252 dlg_dump_keys
2253 Write all user-defined key-bindings to the given stream, e.g., as part
2254 of dlg_create_rc.
2255
2256 FILE * fp
2257 is the stream on which to write the bindings.
2258
2259 dlg_dump_window_keys
2260 Write all user-defined key-bindings to the given stream, e.g., as part
2261 of dlg_create_rc.
2262
2263 FILE * fp
2264 is the stream on which to write the bindings.
2265
2266 WINDOW * win
2267 is the window for which bindings should be dumped. If it is null,
2268 then only built-in bindings are dumped.
2269
2270 dlg_eat_argv
2271 Remove one or more items from an argument vector.
2272
2273 int * argcp
2274 in/out parameter giving the length of the argument vector. char
2275 *** argvp in/out parameter pointing to the argument vector. int
2276 start starting index. int count number of arguments to remove.
2277
2278 dlg_edit_offset
2279 Given the character-offset in the string, returns the display-offset
2280 where dialog should position the cursor. In this context, “characters”
2281 may be multicolumn, since the string can be a multibyte character
2282 string.
2283
2284 char * string
2285 is the string to analyze
2286
2287 int offset
2288 is the character-offset
2289
2290 int x_last
2291 is a limit on the column positions that can be used, e.g., the
2292 window's size.
2293
2294 dlg_edit_string
2295 Updates the string and character-offset, given various editing charac‐
2296 ters or literal characters which are inserted at the character-offset.
2297 Returns true if an editing change was made (and the display should be
2298 updated), and false if the key was something like KEY_ENTER, which is a
2299 non-editing action outside this function.
2300
2301 char * string
2302 is the (multibyte) string to update
2303
2304 int * offset
2305 is the character-offset
2306
2307 int key
2308 is the editing key
2309
2310 int fkey
2311 is true if the editing key is a function-key
2312
2313 bool force
2314 is used in a special loop case by calling code to force the return
2315 value of this function when a function-key code 0 is passed in.
2316
2317 dlg_exit
2318 Given an internal exit code, check if the corresponding environment
2319 variable is set. If so, remap the exit code to match the environment
2320 variable. Finally call exit with the resulting exit code.
2321
2322 int code
2323 is the internal exit code, e.g., DLG_EXIT_OK, which may be
2324 remapped.
2325
2326 The dialog program uses this function to allow shell scripts to remap
2327 the exit codes so they can distinguish ESC from ERROR.
2328
2329 dlg_exitcode2s
2330 Returns the name of an exit-code, e.g., “OK” for DLG_EXIT_OK.
2331
2332 int code
2333 is an exit-code for dialog as defined in <dialog.h>.
2334
2335 dlg_exitname2n
2336 Returns an exit-code as the reverse of dlg_exitcode2n, e.g., 0
2337 (DLG_EXIT_OK) for the “OK” string.
2338
2339 const char * name
2340 is the name of an exit-code for dialog as defined in <dialog.h>
2341 but omitting the “DLG_EXIT_” prefix.
2342
2343 dlg_exit_buttoncode
2344 Map the given button index for dlg_exit_label into dialog's exit-code.
2345
2346 int button
2347 is the button index
2348
2349 dlg_exit_label
2350 Return a list of button labels. If dialog_vars.extra_button is true,
2351 return the result of dlg_ok_labels. Otherwise, return a list with the
2352 “Exit” label and (if dialog_vars.help_button is set) the “Help” button
2353 as well.
2354
2355 dlg_exiterr
2356 Quit program killing all tailboxbg widgets.
2357
2358 const char * fmt
2359 is the format of the printf-like message to write.
2360
2361 ...
2362 are the variables to apply to the fmt format.
2363
2364 dlg_find_index
2365 Given the character-offset to find in the list, return the correspond‐
2366 ing array index.
2367
2368 const int *list
2369 contains a list of character-offsets, i.e., indices into a string
2370 that denote the beginning of multibyte characters.
2371
2372 int limit
2373 is the last index into list to search.
2374
2375 int to_find
2376 is the character-offset to find.
2377
2378 dlg_finish_string
2379 If DIALOG_STATE.finish_string is true, this function discards data used
2380 to speed up layout computations.
2381
2382 const char * string
2383 is the address of the string whose data should be discarded. The
2384 address rather than contents is used as the unique identifier be‐
2385 cause some of the caching is used for editable input-fields.
2386
2387 dlg_flush_getc
2388 Cancel the local data saved by dlg_last_getc.
2389
2390 dlg_editbox
2391 This entrypoint provides the --editbox functionality without the limi‐
2392 tations of dialog's command-line syntax (compare to dialog_editbox).
2393
2394 const char * title
2395 is the title string to display at the top of the widget.
2396
2397 char *** list
2398 is a pointer to an array of char * pointers. The array is allo‐
2399 cated by the caller, and so are the strings to which it points.
2400 The dlg_editbox function may reallocate the array and the strings.
2401
2402 int * rows
2403 points to the nominal length of list. The referenced value is up‐
2404 dated iflist is reallocated.
2405
2406 int height
2407 is the desired height of the box. If zero, the height is adjusted
2408 to use the available screen size.
2409
2410 int width
2411 is the desired width of the box. If zero, the height is adjusted
2412 to use the available screen size.
2413
2414 dlg_form
2415 This entrypoint provides the --form functionality without the limita‐
2416 tions of dialog's command-line syntax (compare to dialog_form).
2417
2418 const char * title
2419 is the title string to display at the top of the widget.
2420
2421 const char * cprompt
2422 is the prompt text shown within the widget.
2423
2424 int height
2425 is the desired height of the box. If zero, the height is adjusted
2426 to use the available screen size.
2427
2428 int width
2429 is the desired width of the box. If zero, the height is adjusted
2430 to use the available screen size.
2431
2432 int form_height
2433 is the minimum height to reserve for displaying the list. If
2434 zero, it is computed based on the given height and width.
2435
2436 int item_no
2437 is the number of items.
2438
2439 DIALOG_FORMITEM * items
2440 This is a list of the items to display in the form.
2441
2442 int * current_item
2443 The widget sets the referenced location to the index of the cur‐
2444 rent display item (cursor) when it returns.
2445
2446 dlg_free_columns
2447 Free data allocated by dlg_align_columns.
2448
2449 char **target
2450 This is the array which was reformatted. It points to the first
2451 string to free.
2452
2453 int per_row
2454 This is the size of the struct for each row of the array.
2455
2456 int num_rows
2457 This is the number of rows in the array.
2458
2459 dlg_free_formitems
2460 Free memory owned by a list of DIALOG_FORMITEM's.
2461
2462 DIALOG_FORMITEM * items
2463 is the list to free.
2464
2465 dlg_free_gauge
2466 Remove the gauge widget from the screen and free its associated memory.
2467
2468 void *objptr
2469 points to the gauge widget.
2470
2471 dlg_getc
2472 Read a character from the given window. Handle repainting here (to
2473 simplify things in the calling application). Also, if input-call‐
2474 back(s) are set up, poll the corresponding files and handle the up‐
2475 dates, e.g., for displaying a tailbox. Returns the key-code.
2476
2477 WINDOW * win
2478 is the window within which to read.
2479
2480 int * fkey
2481 as a side-effect, set this to true if the key-code is really a
2482 function-key.
2483
2484 dlg_getenv_num
2485 Get a number from the environment:
2486
2487 • If the caller provides a pointer in the second parameter, return
2488 success/failure for the function return, and the actual value via
2489 the pointer. Use this for decoding arbitrary numbers, e.g., nega‐
2490 tive or zero.
2491
2492 • If the caller does not provide a pointer, return the decoded value
2493 for the function-return. Use this when only values greater than
2494 zero are useful.
2495
2496 char * name
2497 is the name of the environment-variable to retrieve.
2498
2499 int * value
2500 is the optional pointer to a return-value.
2501
2502 dlg_getenv_str
2503 Get a string from the environment, rejecting those which are entirely
2504 blank.
2505
2506 char * name
2507 is the name of the environment-variable to retrieve.
2508
2509 dlg_get_attrs
2510 extract the video attributes from the given window.
2511
2512 WINDOW * win
2513 is the window from which to get attributes.
2514
2515 dlg_getc_callbacks
2516 passes the given key-code ch to the current window that has established
2517 a callback. If the callback returns zero, remove it and try the next
2518 window. If no more callbacks remain, return. If any callbacks were
2519 found, return true, otherwise false.
2520
2521 int ch
2522 is the key-code
2523
2524 int fkey
2525 is true if the key is a function-key
2526
2527 int * result
2528 is used to pass an exit-code to the caller, which should pass that
2529 via dlg_exit.
2530
2531 dlg_index_columns
2532 Build a list of the display-columns for the given multibyte string's
2533 characters.
2534
2535 const char * string
2536 is the string to analyze
2537
2538 dlg_index_wchars
2539 Build an index of the wide-characters in the string, so the caller can
2540 easily tell which byte-offset begins a given wide-character.
2541
2542 const char * string
2543 is the string to analyze
2544
2545 dlg_item_help
2546 Draw the string for the dialog_vars.item_help feature.
2547
2548 const char * txt
2549 is the help-message
2550
2551 dlg_keep_tite
2552 This performs the check and modifications for the command-line option
2553 "--keep-tite", used in init_dialog as well as for the command-line op‐
2554 tion --erase-on-exit.
2555
2556 FILE * output
2557 is the output stream used for displaying widgets. It is either
2558 stdout or stderr, depending on the --stdout option.
2559
2560 dlg_killall_bg
2561 If dialog has callbacks active, purge the list of all that are not
2562 marked to keep in the background. If any remain, run those in a back‐
2563 ground process.
2564
2565 int * retval
2566 stores the exit-code to pass back to the caller.
2567
2568 dlg_last_getc
2569 returns the most recent character that was read via dlg_getc.
2570
2571 dlg_limit_columns
2572 Given a column limit, count the number of wide characters that can fit
2573 into that limit. The offset is used to skip over a leading character
2574 that was already written.
2575
2576 const char * string
2577 is the string to analyze
2578
2579 int limit
2580 is the column limit
2581
2582 int offset
2583 is the starting offset from which analysis should continue
2584
2585 dlg_lookup_key
2586 Check for a key-binding. If there is no binding associated with the
2587 widget, it simply returns the given curses-key. Otherwise, it returns
2588 the result of the binding
2589
2590 WINDOW * win
2591 is the window on which the binding is checked
2592
2593 int curses_key
2594 is the curses key-code
2595
2596 int * dialog_key
2597 is the corresponding dialog internal code (see DLG_KEYS_ENUM in
2598 dlg_key.h).
2599
2600 dlg_max_input
2601 Limit the parameter according to dialog_vars.max_input
2602
2603 int max_len
2604 is the value to limit
2605
2606 dlg_match_char
2607 Match a given character against the beginning of the string, ignoring
2608 case of the given character. The matching string must begin with an
2609 uppercase character.
2610
2611 int ch
2612 is the character to check
2613
2614 const char * string
2615 is the string to search
2616
2617 dlg_menu
2618 This entrypoint provides the --menu functionality without the limita‐
2619 tions of dialog's command-line syntax (compare to dialog_menu).
2620
2621 const char * title
2622 is the title string to display at the top of the widget.
2623
2624 const char * cprompt
2625 is the prompt text shown within the widget.
2626
2627 int height
2628 is the desired height of the box. If zero, the height is adjusted
2629 to use the available screen size.
2630
2631 int width
2632 is the desired width of the box. If zero, the height is adjusted
2633 to use the available screen size.
2634
2635 int menu_height
2636 is the minimum height to reserve for displaying the list. If
2637 zero, it is computed based on the given height and width.
2638
2639 int item_no
2640 is the number of items.
2641
2642 DIALOG_LISTITEM * items
2643 This is a list of the items to display in the form.
2644
2645 int * current_item
2646 The widget sets the referenced location to the index of the cur‐
2647 rent display item (cursor) when it returns.
2648
2649 DIALOG_INPUTMENU rename_menutext
2650 If this is not dlg_dummy_menutext, the widget acts like an input‐
2651 menu widget, providing an extra “Rename” button, which activates
2652 an edit feature on the selected menu item.
2653
2654 dlg_move_window
2655 Moves/resizes the given window to the given position and size.
2656
2657 WINDOW *win
2658 is the window to move/resize.
2659
2660 WINDOW *height
2661 is the height of the resized window.
2662
2663 WINDOW *width
2664 is the width of the resized window.
2665
2666 WINDOW *y
2667 y-ordinate to use for the repositioned window.
2668
2669 WINDOW *x
2670 x-ordinate to use for the repositioned window.
2671
2672 dlg_mouse_bigregion
2673 Retrieve the big-region under the pointer.
2674
2675 int y
2676 is the row on which the mouse click occurred
2677
2678 int x
2679 is the column on which the mouse click occurred
2680
2681 dlg_mouse_free_regions
2682 Free the memory associated with mouse regions.
2683
2684 dlg_mouse_mkbigregion
2685 Creates a region on which the mouse-clicks will return a specified
2686 code.
2687
2688 int y
2689 is the top-row of the region.
2690
2691 int x
2692 is the left-column of the region.
2693
2694 int height
2695 is the height of the region.
2696
2697 int width
2698 is the width of the region.
2699
2700 int code
2701 is a code used to make the region unique within a widget
2702
2703 int step_x
2704 is used in modes 2 (columns) and 3 (cells) to determine the width
2705 of a column/cell.
2706
2707 int step_y
2708 is currently unused
2709
2710 int mode
2711 is used to determine how the mouse position is translated into a
2712 code (like a function-key):
2713
2714 1 index by lines
2715
2716 2 index by columns
2717
2718 3 index by cells
2719
2720 dlg_mouse_mkregion
2721 int y
2722 is the top-row of the region.
2723
2724 int x
2725 is the left-column of the region.
2726
2727 int height
2728 is the height of the region.
2729
2730 int width
2731 is the width of the region.
2732
2733 int code
2734 is a code used to make the region unique within a widget
2735
2736 dlg_mouse_region
2737 Retrieve the frame under the mouse pointer
2738
2739 int y
2740 is the row of the mouse-click
2741
2742 int x
2743 is the column of the mouse-click
2744
2745 dlg_mouse_setbase
2746 Sets a base for subsequent calls to dlg_mouse_mkregion, so they can
2747 make regions relative to the start of a given window.
2748
2749 int x
2750 is the left-column for the base
2751
2752 int y
2753 is the top-row for the base
2754
2755 dlg_mouse_setcode
2756 Sets a value used internally by dlg_mouse_mkregion which is added to
2757 the code parameter. By providing different values, e.g., multiples of
2758 KEY_MAX, it is possible to support multiple “big” regions in a widget.
2759 The buildlist widget uses this feature to recognize mouse-clicks in the
2760 left/right panes.
2761
2762 int code
2763 is the value to add to dlg_mouse_mkregion's code parameter.
2764
2765 dlg_mouse_wgetch
2766 is a wrapper for dlg_getc which additionally maps mouse-clicks (if the
2767 curses library supports those) into extended function-keys which encode
2768 the position according to the mode in dlg_mouse_mkbigregion. Returns
2769 the corresponding key-code.
2770
2771 WINDOW * win
2772 is the window on which to perform the input
2773
2774 int * fkey
2775 the referenced location is set to true if the key-code is an ac‐
2776 tual or extended (mouse) function-key.
2777
2778 dlg_mouse_wgetch_nowait
2779 This is a non-blocking variant of dlg_mouse_wgetch.
2780
2781 WINDOW * win
2782 is the window on which to perform the input
2783
2784 int * fkey
2785 the referenced location is set to true if the key-code is an ac‐
2786 tual or extended (mouse) function-key.
2787
2788 dlg_need_separator
2789 Check if an output-separator is needed. If dialog_vars.output_separa‐
2790 tor is set, return true. Otherwise, if dialog_vars.input_result is
2791 nonempty, return true. If neither, return false.
2792
2793 dlg_new_modal_window
2794 Create a modal window, optionally with a shadow. The shadow is created
2795 if dialog_state.use_shadow is true.
2796
2797 WINDOW * parent
2798 is the parent window (usually the top-level window of a widget)
2799
2800 int height
2801 is the window's height
2802
2803 int width
2804 is the window's width
2805
2806 int y
2807 is the window's top-row
2808
2809 int x
2810 is the window's left-column
2811
2812 dlg_new_window
2813 Create a window, optionally with a shadow. The shadow is created if
2814 dialog_state.use_shadow is true.
2815
2816 int height
2817 is the window's height
2818
2819 int width
2820 is the window's width
2821
2822 int y
2823 is the window's top-row
2824
2825 int x
2826 is the window's left-column
2827
2828 dlg_next_button
2829 Return the next index in the list of labels.
2830
2831 const char ** labels
2832 is a list of (pointers to) button labels terminated by a null
2833 pointer.
2834
2835 int button
2836 is the current button-index.
2837
2838 dlg_next_ok_buttonindex
2839 Assuming that the caller is using dlg_ok_labels to list buttons, find
2840 the next index in the list of buttons.
2841
2842 int current
2843 is the current index in the list of buttons
2844
2845 int extra
2846 if negative, provides a way to enumerate extra active areas on the
2847 widget.
2848
2849 dlg_ok_buttoncode
2850 Map the given button index for dlg_ok_labels into dialog's exit-code.
2851
2852 int button
2853 is the button-index (which is not necessarily the same as the in‐
2854 dex in the list of labels).
2855
2856 dlg_ok_button_key
2857 Calls dlg_button_key with the “Cancel” button disabled, e.g., for the
2858 textbox widget.
2859
2860 dlg_ok_label
2861 Returns a list with the “Ok” label, and if dialog_vars.help_button is
2862 true, the “Help” label as well.
2863
2864 dlg_ok_labels
2865 Return a list of button labels for the OK/Cancel group of widgets.
2866
2867 dlg_ordinate
2868 Decode the string as an integer, decrement if greater than zero to make
2869 a curses-ordinate from a dialog-ordinate.
2870
2871 dlg_parse_bindkey
2872 Parse the parameters of the “bindkeys” configuration-file entry. This
2873 expects widget name which may be "*", followed by curses key definition
2874 and then dialog key definition.
2875
2876 char * params
2877 is the parameter string to parse.
2878
2879 dlg_parse_rc
2880 Parse the configuration file and set up variables.
2881
2882 dlg_popen
2883 Open a pipe which ties the standard error and output together. The
2884 popen function captures only the standard output of a command.
2885
2886 const char *command
2887 The shell command to run.
2888
2889 const char *type
2890 Like popen, "r" is used to read, and "w" is used to write.
2891
2892 dlg_prev_button
2893 Return the previous index in the list of labels.
2894
2895 const char ** labels
2896 is a list of (pointers to) button labels terminated by a null
2897 pointer.
2898
2899 int button
2900 is the current button index
2901
2902 dlg_print_listitem
2903 This is a helper function used for the various “list” widgets, e.g.,
2904 checklist, menu, buildlist, treeview. Each list-widget has “tag” and
2905 “description” values for each item which can be displayed. If dia‐
2906 log_vars.no_tags is true, the “tag” value is not shown. The first
2907 character of the first value shown (tag or description) is highlighted
2908 to indicate that the widget will match it for quick navigation.
2909
2910 WINDOW *win
2911 the window in which to display the text
2912
2913 const char *text
2914 the value to display
2915
2916 int climit
2917 the number of columns available for printing the text
2918
2919 bool first
2920 true if this is the first call (for “tag” and “description”), and
2921 the first character of the value should be highlighted.
2922
2923 int selected
2924 nonzero if the text should be displayed using the “selected” col‐
2925 ors
2926
2927 dlg_print_scrolled
2928 This is a wrapper for dlg_print_autowrap which allows the user to
2929 scroll too-long prompt text up/down.
2930
2931 See dlg_check_scrolled for a function which updates the offset variable
2932 used as a parameter here. It complements this function; you need both.
2933 If pauseopt is set, this function returns an updated last parameter,
2934 needed for dlg_check_scrolled calls.
2935
2936 WINDOW * win
2937 is the window to update.
2938
2939 const char * prompt
2940 is the string to print
2941
2942 int offset
2943 is the starting line-number to write wrapped text.
2944
2945 int height
2946 is the available height for writing the wrapped text
2947
2948 int width
2949 is the width that the wrapping should occur in
2950
2951 int pauseopt
2952 is true if the extra functionality for scrolling should be en‐
2953 abled. If false, this calls dlg_print_autowrap without doing any
2954 scrolling.
2955
2956 dlg_print_line
2957 Print one line of the prompt in the window within the limits of the
2958 specified right margin. The line will end on a word boundary and a
2959 pointer to the start of the next line is returned, or a NULL pointer if
2960 the end of *prompt is reached.
2961
2962 WINDOW *win
2963 is the window to update.
2964
2965 chtype *attr
2966 holds the starting attributes, and is updated to reflect the final
2967 attributes applied to the string.
2968
2969 const char *prompt
2970 is the string to print
2971
2972 int lm
2973 is the left margin.
2974
2975 int rm
2976 is the right margin
2977
2978 int *x
2979 returns the ending x-ordinate.
2980
2981 dlg_prev_ok_buttonindex
2982 Find the previous button index in the list from dlg_ok_labels.
2983
2984 int current
2985 is the current index
2986
2987 int extra
2988 if negative provides a way to enumerate extra active areas on the
2989 widget.
2990
2991 dlg_print_autowrap
2992 Print a string of text in a window, automatically wrap around to the
2993 next line if the string is too long to fit on one line. Note that the
2994 string may contain embedded newlines. The text is written starting at
2995 the top of the window.
2996
2997 WINDOW * win
2998 is the window to update.
2999
3000 const char * prompt
3001 is the string to print
3002
3003 int height
3004 is the nominal height the wrapped string is limited to
3005
3006 int width
3007 is the width that the wrapping should occur in
3008
3009 dlg_print_size
3010 If dialog_vars.print_siz is true, print the given height/width (from a
3011 widget) to dialog_state.output, e.g., Size: height, width.
3012
3013 int height
3014 is the window's height
3015
3016 int width
3017 is the window's width
3018
3019 dlg_print_text
3020 Print up to cols columns from text, optionally rendering dialog's es‐
3021 cape sequences for attributes and color.
3022
3023 WINDOW * win
3024 is the window to update.
3025
3026 const char * txt
3027 is the string to print
3028
3029 int col
3030 is the column limit
3031
3032 chtype * attr
3033 holds the starting attributes, and is updated to reflect the final
3034 attributes applied to the string.
3035
3036 dlg_progressbox
3037 implements the "--prgbox" and "--progressbox" options.
3038
3039 const char * title
3040 is the title on the top of the widget.
3041
3042 const char * cprompt
3043 is the prompt text shown within the widget. If empty or null, no
3044 prompt is shown.
3045
3046 int height
3047 is the desired height of the box. If zero, the height is based on
3048 the screen size.
3049
3050 int width
3051 is the desired width of the box. If zero, the height is based on
3052 the screen size.
3053
3054 int pauseopt
3055 if true, an “OK” button will be shown, and the dialog will wait
3056 for it to complete. With an “OK” button, it is denoted a “pro‐
3057 grambox”, without an “OK” button, it is denoted a “progressbox”.
3058
3059 FILE * fp
3060 is the file pointer, which may be a pipe or a regular file.
3061
3062 dlg_put_backtitle
3063 Display the background title if dialog_vars.backtitle is non-null. The
3064 background title is shown at the top of the screen.
3065
3066 dlg_reallocate_gauge
3067 Allocates or reallocates a gauge widget (see dlg_allocate_gauge). Use
3068 dlg_update_gauge to display the result.
3069
3070 void ** objptr
3071 If the pointer referenced by this parameter is null, the function
3072 creates a new gauge widget using dlg_allocate_gauge. Otherwise,
3073 it updates the title and cprompt values, reusing the window from
3074 the previous call on this function. As a side-effect, the func‐
3075 tion stores the updated object-pointer via the objptr parameter.
3076
3077 const char * title
3078 is the title string to display at the top of the widget.
3079
3080 const char * cprompt
3081 is the prompt text shown within the widget.
3082
3083 int height
3084 is the desired height of the box. If zero, the height is adjusted
3085 to use the available screen size.
3086
3087 int width
3088 is the desired width of the box. If zero, the height is adjusted
3089 to use the available screen size.
3090
3091 int percent
3092 is the percentage to show in the progress bar.
3093
3094 dlg_register_buttons
3095 The widget developer should call this function after dlg_register_win‐
3096 dow, for the list of button labels associated with the widget. One may
3097 bind a key to a button, e.g., “OK” for DLGK_OK,
3098
3099 WINDOW * win
3100 is the window with which to associate the buttons
3101
3102 const char * name
3103 is the widget's binding name (usually the name of the widget).
3104
3105 const char ** buttons
3106 is the list of buttons
3107
3108 dlg_register_window
3109 For a given named widget's window, associate a binding table.
3110
3111 WINDOW * win
3112 is the window with which to associate the buttons
3113
3114 const char * name
3115 is the widget's binding name (usually the name of the widget).
3116
3117 DLG_KEYS_BINDING * binding
3118 is the binding table
3119
3120 dlg_remove_callback
3121 Remove a callback.
3122
3123 DIALOG_CALLBACK * p
3124 contains the callback information.
3125
3126 dlg_renamed_menutext
3127 This is a utility function which supports the --inputmenu option of the
3128 dialog program. If dialog_vars.input_menu is set, dialog_menu passes
3129 this pointer to dlg_menu as the rename_menutext parameter. Otherwise,
3130 it passes dlg_dummy_menutext.
3131
3132 The function should add “RENAMED” to dialog_vars.input_result , fol‐
3133 lowed by the menu item's name and the newtext value (with a space sepa‐
3134 rating the three items), and return DLG_EXIT_EXTRA.
3135
3136 DIALOG_LISTITEM * items
3137 is the list of menu items
3138
3139 int current
3140 is the index of the currently-selected item
3141
3142 char * newtext
3143 is the updated text for the menu item
3144
3145 dlg_reset_timeout
3146 Calls wtimeout with the value saved for a window in the last call to
3147 dlg_set_timeout.
3148
3149 dlg_restore_vars
3150 Restore dialog's variables from the given variable (see dia‐
3151 log_save_vars).
3152
3153 DIALOG_VARS * save
3154 is the variable from which to restore.
3155
3156 The DIALOG_VARS.input_length and DIALOG_VARS.input_result members are
3157 treated specially, since these are used by a widget to pass data to the
3158 caller. They are not modified by this function.
3159
3160 dlg_result_key
3161 Test a dialog internal keycode to see if it corresponds to one of the
3162 push buttons on the widget such as “OK”. This is only useful if there
3163 are user-defined key bindings, since there are no built-in bindings
3164 that map directly to DLGK_OK, etc. Return true if a mapping was done.
3165
3166 int dialog_key
3167 is the dialog key to test
3168
3169 int fkey
3170 is true if this is a function key
3171
3172 int * resultp
3173 store the result of the mapping in the referenced location.
3174
3175 dlg_save_vars
3176 Save dialog's variables into the given variable (see dlg_restore_vars).
3177
3178 DIALOG_VARS * save
3179 is the variable into which to save.
3180
3181 dlg_set_focus
3182 Set focus on the given window, making it display above other windows on
3183 the screen.
3184
3185 WINDOW * parent
3186 is the parent window (usually the top-level window of a widget)
3187
3188 WINDOW * win
3189 is the window on which to place focus (usually a subwindow of a
3190 widget)
3191
3192 dlg_set_result
3193 Setup a fixed-buffer for the result in dialog_vars.input_result
3194
3195 const char * string
3196 is the new contents for the result
3197
3198 dlg_set_timeout
3199 Calls wtimeout to establish a preferred timeout for nonblocking reads,
3200 e.g., to allow the gauge widget to handle window-resizing events. The
3201 dlg_may_resize function temporarily overrides this value, to allow it
3202 to skip over the error codes returned while the ncurses library pro‐
3203 cesses window-resizing events. It restores the value established in
3204 this call by calling dlg_restore_timeout.
3205
3206 WINDOW * win
3207 is the window whose input-timeout should be set
3208
3209 bool will_getc
3210 is true if the widget is expected to read keyboard characters.
3211 Some (such as the gauge widget) do not.
3212
3213 dlg_show_string
3214 Displays the string, shifted as necessary, to fit within the box and
3215 show the current character-offset.
3216
3217 WINDOW * win
3218 is the window within which to display
3219
3220 const char * string
3221 is the string to display
3222
3223 int offset
3224 is the starting (character, not bytes) offset
3225
3226 chtype attr
3227 is the window attribute to use for the string
3228
3229 int y_base
3230 beginning row on screen
3231
3232 int x_base
3233 beginning column on screen
3234
3235 int x_last
3236 number of columns on screen
3237
3238 bool hidden
3239 if true, do not echo input
3240
3241 bool force
3242 if true, force repaint
3243
3244 dlg_strclone
3245 duplicate the string, like strdup.
3246
3247 const char * cprompt
3248 is the string to duplicate
3249
3250 dlg_strcmp
3251 compare two strings, ignoring case.
3252
3253 const char * a
3254 is one string
3255
3256 const char * b
3257 is the other string
3258
3259 dlg_string_to_argv
3260 Convert a string to an argument vector returning an index (which must
3261 be freed by the caller). The string is modified:
3262
3263 • Blanks between arguments are replaced by nulls.
3264
3265 • Normally arguments are separated by blanks; however you can double-
3266 quote an argument to enclose blanks. The surrounding double-quotes
3267 are removed from the string.
3268
3269 • A backslash preceding a double-quote within double-quotes is re‐
3270 moved.
3271
3272 • A backslash preceding a newline outside double-quotes is removed.
3273
3274 • Except for special cases, backslashes are preserved in the strings,
3275 since other dialog functions interpret backslashes, e.g., for col‐
3276 ors.
3277
3278 char *blob
3279 is the string to convert.
3280
3281 dlg_sub_window
3282 create a subwindow, e.g., for an input area of a widget
3283
3284 WINDOW * win
3285 is the parent window
3286
3287 int height
3288 is the subwindow's height
3289
3290 int width
3291 is the subwindow's width
3292
3293 int y
3294 is the subwindow's top-row
3295
3296 int x
3297 is the subwindow's left-column
3298
3299 dlg_tab_correct_str
3300 If the dialog_vars.tab_correct is true, convert tabs to single spaces.
3301 Return the converted result. The caller is responsible for freeing the
3302 string.
3303
3304 char * prompt
3305 is the string to convert
3306
3307 dlg_trace
3308 If the parameter is non-null, opens a trace file with that name and
3309 stores the file pointer in dialog_state.trace.
3310
3311 dlg_trace_2n
3312 logs a numeric value as a comment.
3313
3314 char * name
3315 is the name to log in the comment.
3316
3317 int value
3318 is the value to log in the comment.
3319
3320 dlg_trace_2s
3321 logs a string value as a comment. If the value contains embedded new‐
3322 lines, the comment is continued with “#+” markers.
3323
3324 char * name
3325 is the name to log in the comment.
3326
3327 int value
3328 is the value to log in the comment.
3329
3330 dlg_trace_chr
3331 If dialog_state.trace is set, translate the parameters into a printable
3332 representation, log it on a “chr” line.
3333
3334 int ch
3335 is the nominal keycode value.
3336
3337 int fkey
3338 is nonzero if the value is really a function key. Some of these
3339 may be values declared in the DLG_KEYS_ENUM.
3340
3341 dlg_trace_msg
3342 Write a formatted message to the trace file.
3343
3344 const char * fmt
3345 is the format of the printf-like message to write.
3346
3347 ...
3348 are the variables to apply to the fmt format.
3349
3350 Use the DLG_TRACE macro for portability, in case the trace feature is
3351 not compiled into the library. It uses an extra level of parentheses
3352 to work with a variable number of parameters, e.g.,
3353
3354 DLG_TRACE(("this is dialog version %s\n", dialog_version()));
3355
3356 dlg_trace_va_msg
3357 Write a formatted message to the trace file.
3358
3359 const char *fmt
3360 is the format of the printf-like message to write.
3361
3362 va_list ap
3363 are the variables to apply to the fmt format.
3364
3365 This is used in dlg_exiterr to capture error messages in the trace
3366 file:
3367
3368 va_start(ap, fmt);
3369 dlg_trace_msg("## Error: ");
3370 dlg_trace_va_msg(fmt, ap);
3371 va_end(ap);
3372
3373 Unlike dlg_trace_msg, an extra macro is not needed.
3374
3375 dlg_ttysize
3376 Returns the screensize without using curses. That allows the function
3377 to be used before initializing the screen.
3378
3379 dlg_trace_win
3380 If dialog_state.trace is set, log a printable picture of the given win‐
3381 dow.
3382
3383 dlg_treeview
3384 This is an alternate interface to 'treeview' which allows the applica‐
3385 tion to read the list item states back directly without putting them in
3386 the output buffer.
3387
3388 const char * title
3389 is the title on the top of the widget.
3390
3391 const char * cprompt
3392 is the prompt text shown within the widget.
3393
3394 int height
3395 is the desired height of the box. If zero, the height is based on
3396 the screen size.
3397
3398 int width
3399 is the desired width of the box. If zero, the height is based on
3400 the screen size.
3401
3402 int list_height
3403 is the minimum height to reserve for displaying the list. If
3404 zero, it is computed based on the given height and width.
3405
3406 int item_no
3407 is the number of rows in items.
3408
3409 DIALOG_LISTITEM * items
3410 is the list of items, contain tag, name, and optionally help
3411 strings (if dialog_vars.item_help is set). The initial selection
3412 state for each item is also in this list.
3413
3414 const char * states
3415 This is a list of characters to display for the given states.
3416 Normally a buildlist provides true (1) and false (0) values, which
3417 the widget displays as "*" and space, respectively. An applica‐
3418 tion may set this parameter to an arbitrary null-terminated
3419 string. The widget determines the number of states from the
3420 length of this string, and will cycle through the corresponding
3421 display characters as the user presses the space-bar.
3422
3423 int * depths
3424 This is a list of depths of each item in the tree. It is a sepa‐
3425 rate parameter from items to allow reuse of the existing func‐
3426 tions.
3427
3428 int flag
3429 is either FLAG_CHECK, for checklists (multiple selections), or
3430 FLAG_RADIO for radiolists (a single selection).
3431
3432 int * current_item
3433 The widget sets the referenced location to the index of the cur‐
3434 rent display item (cursor) when it returns.
3435
3436 dlg_trim_string
3437 The dialog program uses this in each widget to adjust the message
3438 string, which may contain the newline character (referred to as '\n')
3439 and/or the special substring "\n" (which can be translated into a new‐
3440 line character).
3441
3442 There are several optional features:
3443
3444 • Unless dialog_vars.nocollapse is set, each tab is converted to a
3445 space before other processing.
3446
3447 • If dialog_vars.no_nl_expand is not set, and the string has "\n"
3448 substrings:
3449
3450 • The function changes embedded "\n" substrings to '\n' charac‐
3451 ters.
3452
3453 The function preserves extra spaces after these substitutions.
3454 For instance, spaces following a newline (substring or charac‐
3455 ter) are preserved to use as an indentation.
3456
3457 • If dialog_vars.cr_wrap is set, the function preserves '\n' new‐
3458 line characters. Otherwise, each '\n' newline character is
3459 converted to a space.
3460
3461 • Otherwise, if dialog_vars.trim_whitespace is set:
3462
3463 • This function strips all extra spaces to simplify justifica‐
3464 tion.
3465
3466 • If dialog_vars.cr_wrap is set, the function preserves '\n' new‐
3467 line characters. Otherwise, each '\n' newline character is
3468 converted to a space.
3469
3470 • Finally (if dialog_vars.no_nl_expand is set, or the string does not
3471 contain "\n" substrings, and dialog_vars.trim_whitespace is not
3472 set):
3473
3474 • Unless dialog_vars.nocollapse is set, sequences of spaces are
3475 reduced to a single space.
3476
3477 char * src
3478 is the string to trim
3479
3480 dlg_unregister_window
3481 Remove the bindings for a given window.
3482
3483 WINDOW * win
3484 is the window from which to remove bindings
3485
3486 dlg_update_gauge
3487 Update a gauge widget to show a different percentage value.
3488
3489 void *objptr
3490 points to the gauge object to update.
3491
3492 int percent
3493 is the new percentage value to display.
3494
3495 dlg_will_resize
3496 This filters out bursts of KEY_RESIZE values. Call this after dlg_getc
3497 returns KEY_RESIZE, to improve performance.
3498
3499 dlg_yes_buttoncode
3500 Map the given button index for dlg_yes_labels into dialog's exit-code.
3501
3502 int button
3503 is the button index
3504
3505 dlg_yes_labels
3506 Return a list of buttons for Yes/No labels.
3507
3508 end_dialog
3509 End use of dialog functions.
3510
3511 init_dialog
3512 Do some initialization for dialog.
3513
3514 FILE *input
3515 is the real tty input of dialog. Usually it is the standard in‐
3516 put, but if --input-fd option is used, it may be anything.
3517
3518 FILE *output
3519 is where dialog will send its result. Usually it is the standard
3520 error, but if --stdout or --output-fd is used, it may be anything.
3521
3523 dialog (1).
3524
3526 Thomas E. Dickey
3527
3528
3529
3530$Date: 2021/06/21 08:08:16 $ DIALOG(3)