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.
1205
1206 const char * title
1207 is the title on the top of the widget.
1208
1209 const char * subtitle
1210 is the prompt text shown within the widget.
1211
1212 int height
1213 is the desired height of the box. If zero, the height is based on
1214 the screen size.
1215
1216 int width
1217 is the desired width of the box. If zero, the height is based on
1218 the screen size.
1219
1220 int hour
1221 is the initial hour shown. If the value is negative, the current
1222 hour is used. Returns DLG_EXIT_ERROR if the value specified is
1223 greater than or equal to 24.
1224
1225 int minute
1226 is the initial minute shown. If the value is negative, the cur‐
1227 rent minute is used. Returns DLG_EXIT_ERROR if the value speci‐
1228 fied is greater than or equal to 60.
1229
1230 int second
1231 is the initial second shown. If the value is negative, the cur‐
1232 rent second is used. Returns DLG_EXIT_ERROR if the value speci‐
1233 fied is greater than or equal to 60.
1234
1235 dialog_treeview
1236 implements the "--treeview" option.
1237
1238 const char * title
1239 is the title on the top of the widget.
1240
1241 const char * cprompt
1242 is the prompt text shown within the widget.
1243
1244 int height
1245 is the desired height of the box. If zero, the height is based on
1246 the screen size.
1247
1248 int width
1249 is the desired width of the box. If zero, the height is based on
1250 the screen size.
1251
1252 int list_height
1253 is the minimum height to reserve for displaying the list. If
1254 zero, it is computed based on the given height and width.
1255
1256 int item_no
1257 is the number of rows in items.
1258
1259 char ** items
1260 is the list of items, contain tag, name, and optionally help
1261 strings (if dialog_vars.item_help is set). The initial selection
1262 state for each item is also in this list.
1263
1264 int flag
1265
1266 flag is either FLAG_CHECK, for checklists (multiple selections), or
1267 FLAG_RADIO for radiolists (a single selection).
1268
1269 dialog_yesno
1270 implements the "--yesno" option.
1271
1272 const char * title
1273 is the title on the top of the widget.
1274
1275 const char * cprompt
1276 is the prompt text shown within the widget.
1277
1278 int height
1279 is the desired height of the box. If zero, the height is based on
1280 the screen size.
1281
1282 int width
1283 is the desired width of the box. If zero, the height is based on
1284 the screen size.
1285
1287 Most functions that implement lower-level functionality for the com‐
1288 mand-line dialog program or widgets, have names beginning "dlg_". Bow‐
1289 ing to longstanding usage, the functions that initialize the display
1290 and end it are named init_dialog and end_dialog.
1291
1292 The only non-widget function whose name begins with "dialog_" is dia‐
1293 log_version, which returns the version number of the library as a
1294 string.
1295
1296 A few functions are prefixed "_dlg_", because they are required for in‐
1297 ternal use, but not intended as part of the library application pro‐
1298 gramming interface.
1299
1300 Here is a brief summary of the utility functions and their parameters:
1301
1302 dlg_add_callback
1303 Add a callback, used to allow polling input from multiple tailbox wid‐
1304 gets.
1305
1306 DIALOG_CALLBACK *p
1307 contains the callback information.
1308
1309 dlg_add_callback_ref
1310 Like dlg_add_callback, but passes a reference to the DIALOG_CALLBACK as
1311 well as a pointer to a cleanup function which will be called when the
1312 associated input ends.
1313
1314 DIALOG_CALLBACK **p
1315 points to the callback information. This is a reference to the
1316 pointer so that the caller's pointer can be zeroed when input
1317 ends.
1318
1319 DIALOG_FREEBACK func
1320 function to call when input ends, e.g., to free caller's addi‐
1321 tional data.
1322
1323 dlg_add_help_formitem
1324 This is a utility function used enforce consistent behavior for the DI‐
1325 ALOG_VARS.help_tags and DIALOG_VARS.item_help variables.
1326
1327 int *result
1328 this is updated to DLG_EXIT_ITEM_HELP if DIALOG_VARS.item_help is
1329 set.
1330
1331 char **tag
1332 the tag- or help-text is stored here.
1333
1334 DIALOG_FORMITEM *item
1335 contains the list item to use for tag- or help-text.
1336
1337 dlg_add_help_listitem
1338 This is a utility function used enforce consistent behavior for the DI‐
1339 ALOG_VARS.help_tags and DIALOG_VARS.item_help variables.
1340
1341 int *result
1342 this is updated to DLG_EXIT_ITEM_HELP if DIALOG_VARS.item_help is
1343 set.
1344
1345 char **tag
1346 the tag- or help-text is stored here.
1347
1348 DIALOG_LISTITEM *item
1349 contains the list item to use for tag- or help-text.
1350
1351 dlg_add_last_key
1352 Report the last key entered by the user. This implements the
1353 --last-key command-line option, using dialog_vars.last_key.
1354
1355 int mode
1356 controls the way the last key report is separated from other re‐
1357 sults:
1358
1359 -2 (no separator)
1360
1361 -1 (separator after the key name)
1362
1363 0 (separator is optionally before the key name)
1364
1365 1 (same as -1)
1366
1367 dlg_add_quoted
1368 Add a quoted string to the result buffer (see dlg_add_result). If no
1369 quotes are necessary, none are used. If dialog_vars.single_quoted is
1370 set, single-quotes are used. Otherwise, double-quotes are used.
1371
1372 char * string
1373 is the string to add.
1374
1375 dlg_add_result
1376 Add a string to the result buffer dialog_vars.input_result.
1377
1378 char * string
1379 is the string to add.
1380
1381 dlg_add_separator
1382 Add an output-separator to the result buffer dialog_vars.input_result.
1383 If dialog_vars.output_separator is set, use that. Otherwise, if dia‐
1384 log_vars.separate_output is set, use newline. If neither is set, use a
1385 space.
1386
1387 dlg_add_string
1388 Add a quoted or unquoted string to the result buffer (see
1389 dlg_add_quoted) and dlg_add_result), according to whether dia‐
1390 log_vars.quoted is true.
1391
1392 char * string
1393 is the string to add.
1394
1395 dlg_align_columns
1396 Copy and reformat an array of pointers to strings, aligning according
1397 to the column separator dialog_vars.column_separator. If no column
1398 separator is set, the array will be unmodified; otherwise it is copied
1399 and reformatted.
1400
1401 Caveat: This function is only implemented for 8-bit characters.
1402
1403 char **target
1404 This is the array to reformat. It points to the first string to
1405 modify.
1406
1407 int per_row
1408 This is the size of the struct for each row of the array.
1409
1410 int num_rows
1411 This is the number of rows in the array.
1412
1413 dlg_allocate_gauge
1414 Allocates a gauge widget. Use dlg_update_gauge to display the result.
1415
1416 const char * title
1417 is the title string to display at the top of the widget.
1418
1419 const char * cprompt
1420 is the prompt text shown within the widget.
1421
1422 int height
1423 is the desired height of the box. If zero, the height is adjusted
1424 to use the available screen size.
1425
1426 int width
1427 is the desired width of the box. If zero, the height is adjusted
1428 to use the available screen size.
1429
1430 int percent
1431 is the percentage to show in the progress bar.
1432
1433 dlg_asciibox
1434 returns its parameter transformed to the corresponding "+" or "-",
1435 etc., for the line-drawing characters used in dialog. If the parameter
1436 is not a line-drawing or other special character such as ACS_DARROW, it
1437 returns 0.
1438
1439 chtype ch
1440 is the parameter, usually one of the ACS_xxx constants.
1441
1442 dlg_attr_clear
1443 Set window to the given attribute.
1444
1445 WINDOW * win
1446 is the window to update.
1447
1448 int height
1449 is the number of rows to update.
1450
1451 int width
1452 is the number of columns to update.
1453
1454 chtype attr
1455 is the attribute, e.g., A_BOLD.
1456
1457 dlg_auto_size
1458 Compute window size based on the size of the formatted prompt and mini‐
1459 mum dimensions for a given widget.
1460
1461 Dialog sets dialog_state.text_height and dialog_state.text_width for
1462 the formatted prompt as a side-effect.
1463
1464 Normally dialog writes the formatted prompt to the curses window, but
1465 it will write the formatted prompt to the output stream if dia‐
1466 log_state.text_only is set.
1467
1468 const char * title
1469 is the title string to display at the top of the widget.
1470
1471 const char * prompt
1472 is the message text which will be displayed in the widget, used
1473 here to determine how large the widget should be.
1474
1475 If the value is NULL, dialog allows the widget to use the whole
1476 screen, i.e., if the values referenced by height and/or width are
1477 zero.
1478
1479 int * height
1480 is the nominal height. Dialog checks the referenced value and may
1481 update it:
1482
1483 • if the value is negative, dialog updates it to the available
1484 height of the screen, after reserving rows for the window bor‐
1485 der and shadow, as well as taking into account dialog_vars.be‐
1486 gin_y and dialog_vars.begin_set.
1487
1488 • if the value is zero, dialog updates it to the required height
1489 of the window, taking into account a (possibly) multi-line
1490 prompt.
1491
1492 • if the value is greater than zero, dialog uses it internally,
1493 but restores the value on return.
1494
1495 int * width
1496 is the nominal width. Dialog checks the referenced value and may
1497 update it:
1498
1499 • if the value is negative, dialog updates it to the available
1500 width of the screen, after reserving rows for the window bor‐
1501 der and shadow, as well as taking into account dialog_vars.be‐
1502 gin_x and dialog_vars.begin_set.
1503
1504 • if the value is zero, dialog updates it to the required width
1505 of the window, taking into account a (possibly) multi-line
1506 prompt.
1507
1508 • if the value is greater than zero, dialog uses it internally,
1509 but restores the value on return.
1510
1511 int boxlines
1512 is the number of lines to reserve in the vertical direction.
1513
1514 int mincols
1515 is the minimum number of columns to use.
1516
1517 dlg_auto_sizefile
1518 Like dlg_auto_size, but use a file contents to decide how large the
1519 widget should be.
1520
1521 const char * title
1522 is the title string to display at the top of the widget.
1523
1524 const char * file
1525 is the name of the file.
1526
1527 int * height
1528 is the nominal height.
1529
1530 If it is -1, use the screen's height (after subtracting dia‐
1531 log_vars.begin_y if dialog_vars.begin_set is true).
1532
1533 If it is greater than zero, limit the referenced value to the
1534 screen-height after verifying that the file exists.
1535
1536 int * width
1537 is the nominal width.
1538
1539 If it is -1, use the screen's width (after subtracting dia‐
1540 log_vars.begin_x if dialog_vars.begin_set is true).
1541
1542 If it is greater than zero, limit the referenced value to the
1543 screen-width after verifying that the file exists.
1544
1545 int boxlines
1546 is the number of lines to reserve on the screen for drawing boxes.
1547
1548 int mincols
1549 is the number of columns to reserve on the screen for drawing
1550 boxes.
1551
1552 dlg_beeping
1553 If dialog_vars.beep_signal is nonzero, this calls beep once and sets
1554 dialog_vars.beep_signal to zero.
1555
1556 dlg_boxchar
1557 returns its chtype parameter transformed as follows:
1558
1559 • if neither dialog_vars.ascii_lines nor dialog_vars.no_lines is set.
1560
1561 • if dialog_vars.ascii_lines is set, returns the corresponding "+" or
1562 "-", etc., for the line-drawing characters used in dialog.
1563
1564 • otherwise, if dialog_vars.no_lines is set, returns a space for the
1565 line-drawing characters.
1566
1567 • if the parameter is not a line-drawing or other special character
1568 such as ACS_DARROW, it returns the parameter unchanged.
1569
1570 dlg_box_x_ordinate
1571 returns a suitable x-ordinate (column) for a new widget. If dia‐
1572 log_vars.begin_set is 1, use dialog_vars.begin_x; otherwise center the
1573 widget on the screen (using the width parameter).
1574
1575 int width
1576 is the width of the widget.
1577
1578 dlg_box_y_ordinate
1579 returns a suitable y-ordinate (row) for a new widget. If dia‐
1580 log_vars.begin_set is 1, use dialog_vars.begin_y; otherwise center the
1581 widget on the screen (using the height parameter).
1582
1583 int height
1584 is the height of the widget.
1585
1586 dlg_buildlist
1587 This is an alternate interface to the buildlist widget which allows the
1588 application to read the list item states back directly without putting
1589 them in the output buffer.
1590
1591 const char * title
1592 is the title string to display at the top of the widget.
1593
1594 const char * cprompt
1595 is the prompt text shown within the widget.
1596
1597 int height
1598 is the desired height of the box. If zero, the height is adjusted
1599 to use the available screen size.
1600
1601 int width
1602 is the desired width of the box. If zero, the height is adjusted
1603 to use the available screen size.
1604
1605 int list_height
1606 is the minimum height to reserve for displaying the list. If
1607 zero, it is computed based on the given height and width.
1608
1609 int item_no
1610 is the number of rows in items.
1611
1612 DIALOG_LISTITEM * items
1613 is the list of items, contain tag, name, and optionally help
1614 strings (if dialog_vars.item_help is set). The initial selection
1615 state for each item is also in this list.
1616
1617 const char * states
1618 This is a list of characters to display for the given states.
1619 Normally a buildlist provides true (1) and false (0) values, which
1620 the widget displays as "*" and space, respectively. An applica‐
1621 tion may set this parameter to an arbitrary null-terminated
1622 string. The widget determines the number of states from the
1623 length of this string, and will cycle through the corresponding
1624 display characters as the user presses the space-bar.
1625
1626 int order_mode
1627 is reserved for future enhancements
1628
1629 int * current_item
1630 The widget sets the referenced location to the index of the cur‐
1631 rent display item (cursor) when it returns.
1632
1633 dlg_button_count
1634 Count the buttons in the list.
1635
1636 const char ** labels
1637 is a list of (pointers to) button labels terminated by a null
1638 pointer.
1639
1640 dlg_button_key
1641 If a key was bound to one of the button-codes in dlg_result_key, fake a
1642 button-value and an “Cancel” key to cause the calling widget to return
1643 the corresponding status.
1644
1645 See dlg_ok_buttoncode, which maps settings for ok/extra/help and button
1646 number into exit-code.
1647
1648 dlg_button_layout
1649 Make sure there is enough space for the buttons by computing the width
1650 required for their labels, adding margins and limiting based on the
1651 screen size.
1652
1653 const char ** labels
1654 is a list of (pointers to) button labels terminated by a null
1655 pointer.
1656
1657 int * limit
1658 the function sets the referenced limit to the width required for
1659 the buttons (limited by the screen size) if that is wider than the
1660 passed-in limit.
1661
1662 dlg_button_sizes
1663 Compute the size of the button array in columns.
1664
1665 const char ** labels
1666 is a list of (pointers to) button labels terminated by a null
1667 pointer.
1668
1669 int vertical
1670 is true if the buttons are arranged in a column rather than a row.
1671
1672 int * longest
1673 Return the total number of columns in the referenced location.
1674
1675 int * length
1676 Return the longest button's columns in the referenced location.
1677
1678 dlg_button_to_char
1679 Find the first uppercase character in the label, which we may use for
1680 an abbreviation. If the label is empty, return -1. If no uppercase
1681 character is found, return 0. Otherwise return the uppercase charac‐
1682 ter.
1683
1684 Normally dlg_draw_buttons and dlg_char_to_button use the first upper‐
1685 case character. However, they keep track of all of the labels and if
1686 the first has already been used in another label, they will continue
1687 looking for another uppercase character. This function does not have
1688 enough information to make that check.
1689
1690 const char * label
1691 is the label to test.
1692
1693 dlg_button_x_step
1694 Compute the step-size needed between elements of the button array.
1695
1696 const char ** labels
1697 is a list of (pointers to) button labels terminated by a null
1698 pointer.
1699
1700 int limit
1701 is the maximum number of columns to allow for the buttons.
1702
1703 int * gap
1704 store the nominal gap between buttons in the referenced location.
1705 This is constrained to be at least one.
1706
1707 int * margin
1708 store the left+right total margins (for the list of buttons) in
1709 the referenced location.
1710
1711 int * step
1712 store the step-size in the referenced location.
1713
1714 dlg_calc_list_width
1715 Calculate the minimum width for the list, assuming none of the items
1716 are truncated.
1717
1718 int item_no
1719 is the number of items.
1720
1721 DIALOG_LISTITEM * items
1722 contains a name and text field, e.g., for checklists or radiobox
1723 lists. The function returns the sum of the widest columns needed
1724 for of each of these fields.
1725
1726 If dialog_vars.no_items is set, the text fields in the list are
1727 ignored.
1728
1729 dlg_calc_listh
1730 Calculate new height and list_height values.
1731
1732 int * height
1733 on input, is the height without adding the list-height. On re‐
1734 turn, this contains the total list-height and is the actual wid‐
1735 get's height.
1736
1737 int * list_height
1738 on input, is the requested list-height. On return, this contains
1739 the number of rows available for displaying the list after taking
1740 into account the screen size and the dialog_vars.begin_set and di‐
1741 alog_vars.begin_y variables.
1742
1743 int item_no
1744 is the number of items in the list.
1745
1746 dlg_calc_listw
1747 This function is obsolete, provided for library-compatibility. It is
1748 replaced by dlg_calc_list_width.
1749
1750 int item_no
1751 is the number of items.
1752
1753 char ** items
1754 is a list of character pointers.
1755
1756 int group
1757 is the number of items in each group, e.g., the second array in‐
1758 dex.
1759
1760 dlg_char_to_button
1761 Given a list of button labels, and a character which may be the abbre‐
1762 viation for one, find it, if it exists. An abbreviation will be the
1763 first character which happens to be capitalized in the label. If the
1764 character is found, return its index within the list of labels. Other‐
1765 wise, return DLG_EXIT_UNKNOWN.
1766
1767 int ch
1768 is the character to find.
1769
1770 const char ** labels
1771 is a list of (pointers to) button labels terminated by a null
1772 pointer.
1773
1774 dlg_checklist
1775 This entrypoint provides the --checklist or --radiolist functionality
1776 without the limitations of dialog's command-line syntax (compare to di‐
1777 alog_checklist).
1778
1779 const char * title
1780 is the title string to display at the top of the widget.
1781
1782 const char * cprompt
1783 is the prompt text shown within the widget.
1784
1785 int height
1786 is the desired height of the box. If zero, the height is adjusted
1787 to use the available screen size.
1788
1789 int width
1790 is the desired width of the box. If zero, the height is adjusted
1791 to use the available screen size.
1792
1793 int list_height
1794 is the minimum height to reserve for displaying the list. If
1795 zero, it is computed based on the given height and width.
1796
1797 int item_no
1798 is the number of items.
1799
1800 DIALOG_LISTITEM * items
1801 This is a list of the items to display in the checklist.
1802
1803 const char * states
1804 This is a list of characters to display for the given states.
1805 Normally a checklist provides true (1) and false (0) values, which
1806 the widget displays as "*" and space, respectively. An applica‐
1807 tion may set this parameter to an arbitrary null-terminated
1808 string. The widget determines the number of states from the
1809 length of this string, and will cycle through the corresponding
1810 display characters as the user presses the space-bar.
1811
1812 int flag
1813 This is should be one of FLAG_CHECK or FLAG_RADIO, depending on
1814 whether the widget should act as a checklist or radiobox.
1815
1816 int * current_item
1817 The widget sets the referenced location to the index of the cur‐
1818 rent display item (cursor) when it returns.
1819
1820 dlg_check_scrolled
1821 given a function key (or other key that was mapped to a function key),
1822 check if it is one of the up/down scrolling functions:
1823
1824 DLGK_PAGE_FIRST,
1825 DLGK_PAGE_LAST,
1826 DLGK_GRID_UP,
1827 DLGK_GRID_DOWN,
1828 DLGK_PAGE_PREV or
1829 DLGK_PAGE_NEXT.
1830
1831 Some widgets use these key bindings for scrolling the prompt-text up
1832 and down, to allow for display in very small windows.
1833
1834 The function returns 0 (zero) if it finds one of these keys, and -1 if
1835 not.
1836
1837 int key
1838 is the function-key to check
1839
1840 int last
1841 is the number of lines which would be used to display the scrolled
1842 prompt in an arbitrarily tall window. It is used here to check
1843 limits for the offset value.
1844
1845 int page
1846 this is the available height for writing scrolled text, which is
1847 smaller than the window if it contains buttons.
1848
1849 bool * show
1850 on return, holds TRUE if dlg_print_scrolled should be used to re‐
1851 display the prompt text.
1852
1853 int * offset
1854 on entry, holds the starting line number (counting from zero) last
1855 used for dlg_print_scrolled. On return, holds the updated start‐
1856 ing line number.
1857
1858 dlg_clear
1859 Set window to the default dialog screen attribute. This is set in the
1860 rc-file with screen_color.
1861
1862 dlg_clr_result
1863 Free storage used for the result buffer (dialog_vars.input_result).
1864 The corresponding pointer is set to NULL.
1865
1866 dlg_color_count
1867 Return the number of colors that can be configured in dialog.
1868
1869 dlg_color_setup
1870 Initialize the color pairs used in dialog.
1871
1872 dlg_count_argv
1873 Count the entries in an argument vector.
1874
1875 argv Points to the argument vector.
1876
1877 dlg_count_columns
1878 Returns the number of columns used for a string. This is not necessar‐
1879 ily the number of bytes in a string.
1880
1881 const char * string
1882 is the string to measure.
1883
1884 dlg_count_real_columns
1885 Returns the number of columns used for a string, accounting for "\Z"
1886 sequences which can be used for coloring the text if dialog_vars.colors
1887 is set. This is not necessarily the number of bytes in a string.
1888
1889 const char * string
1890 is the string to measure.
1891
1892 dlg_count_wchars
1893 Returns the number of wide-characters in the string.
1894
1895 const char * string
1896 is the string to measure.
1897
1898 dlg_create_rc
1899 Create a configuration file, i.e., write internal tables to a file
1900 which can be read back by dialog as an rc-file.
1901
1902 const char * filename
1903 is the name of the file to write to.
1904
1905 dlg_ctl_size
1906 If dialog_vars.size_err is true, check if the given window size is too
1907 large to fit on the screen. If so, exit with an error reporting the
1908 size of the window.
1909
1910 int height
1911 is the window's height
1912
1913 int width
1914 is the window's width
1915
1916 dlg_default_button
1917 If dialog_vars.default_button is positive, return the button-index for
1918 that button code, using dlg_ok_buttoncode to test indices starting with
1919 zero. Otherwise (or if no match was found for the button code), return
1920 zero.
1921
1922 dlg_default_formitem
1923 If dialog_vars.default_item is not null, find that name by matching the
1924 name field in the list of form items. If found, return the index of
1925 that item in the list. Otherwise, return zero.
1926
1927 DIALOG_FORMITEM * items
1928 is the list of items to search. It is terminated by an entry with
1929 a null name field.
1930
1931 dlg_default_item
1932 This function is obsolete, provided for library-compatibility. It is
1933 replaced by dlg_default_formitem and dlg_default_listitem.
1934
1935 char ** items
1936 is the list of items to search.
1937
1938 int llen
1939 is the number of items in each group, e.g., the second array in‐
1940 dex.
1941
1942 dlg_defaultno_button
1943 If dialog_vars.defaultno is true, and dialog_vars.nocancel is not, find
1944 the button-index for the “Cancel” button. Otherwise, return the index
1945 for “OK” (always zero).
1946
1947 dlg_del_window
1948 Remove a window, repainting everything else.
1949
1950 WINDOW * win
1951 is the window to remove.
1952
1953 dlg_der_window
1954 create a derived window, e.g., for an input area of a widget
1955
1956 WINDOW * win
1957 is the parent window
1958
1959 int height
1960 is the subwindow's height
1961
1962 int width
1963 is the subwindow's width
1964
1965 int y
1966 is the subwindow's top-row
1967
1968 int x
1969 is the subwindow's left-column
1970
1971 dlg_does_output
1972 This is called each time a widget is invoked which may do output. It
1973 increments dialog_state.output_count, so the output function in dialog
1974 can test this and add a separator.
1975
1976 dlg_draw_arrows
1977 Draw up/down arrows on a window, e.g., for scrollable lists. It calls
1978 dlg_draw_arrows2 using the menubox_color and menubox_border_color at‐
1979 tributes.
1980
1981 WINDOW * dialog
1982 is the window on which to draw an arrow.
1983
1984 int top_arrow
1985 is true if an up-arrow should be drawn at the top of the window.
1986
1987 int bottom_arrow
1988 is true if an down-arrow should be drawn at the bottom of the win‐
1989 dow.
1990
1991 int x
1992 is the zero-based column within the window on which to draw ar‐
1993 rows.
1994
1995 int top
1996 is the zero-based row within the window on which to draw up-arrows
1997 as well as a horizontal line to show the window's top.
1998
1999 int bottom
2000 is the zero-based row within the window on which to draw down-ar‐
2001 rows as well as a horizontal line to show the window's bottom.
2002
2003 dlg_draw_arrows2
2004 Draw up/down arrows on a window, e.g., for scrollable lists.
2005
2006 WINDOW * dialog
2007 is the window on which to draw an arrow.
2008
2009 int top_arrow
2010 is true if an up-arrow should be drawn at the top of the window.
2011
2012 int bottom_arrow
2013 is true if an down-arrow should be drawn at the bottom of the win‐
2014 dow.
2015
2016 int x
2017 is the zero-based column within the window on which to draw ar‐
2018 rows.
2019
2020 int top
2021 is the zero-based row within the window on which to draw up-arrows
2022 as well as a horizontal line to show the window's top.
2023
2024 int bottom
2025 is the zero-based row within the window on which to draw down-ar‐
2026 rows as well as a horizontal line to show the window's bottom.
2027
2028 chtype attr
2029 is the window's background attribute.
2030
2031 chtype borderattr
2032 is the window's border attribute.
2033
2034 dlg_draw_bottom_box
2035 Draw a partial box at the bottom of a window, e.g., to surround a row
2036 of buttons. It is designed to merge with an existing box around the
2037 whole window (see dlg_draw_box), so it uses tee-elements rather than
2038 corner-elements on the top corners of this box.
2039
2040 WINDOW * win
2041 is the window to update.
2042
2043 dlg_draw_bottom_box2
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_box2), 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 chtype on_left
2053 is used to color the upper/left edges of the box, i.e., the tee-
2054 element and horizontal line
2055
2056 chtype on_right
2057 is used to color the right edge of the box, i.e., the tee-element
2058
2059 chtype on_inside
2060 is used to fill-color the inside of the box
2061
2062 dlg_draw_box
2063 Draw a rectangular box with line drawing characters.
2064
2065 WINDOW * win
2066 is the window to update.
2067
2068 int y
2069 is the top row of the box.
2070
2071 int x
2072 is the left column of the box.
2073
2074 int height
2075 is the height of the box.
2076
2077 int width
2078 is the width of the box.
2079
2080 chtype boxchar
2081 is used to color the right/lower edges. It also is fill-color
2082 used for the box contents.
2083
2084 chtype borderchar
2085 is used to color the upper/left edges.
2086
2087 dlg_draw_box2
2088 Draw a rectangular box with line drawing characters.
2089
2090 WINDOW * win
2091 is the window to update.
2092
2093 int y
2094 is the top row of the box.
2095
2096 int x
2097 is the left column of the box.
2098
2099 int height
2100 is the height of the box.
2101
2102 int width
2103 is the width of the box.
2104
2105 chtype boxchar
2106 is used to fill-color for the box contents.
2107
2108 chtype borderchar
2109 is used to color the upper/left edges.
2110
2111 chtype borderchar2
2112 is used to color the right/lower edges.
2113
2114 dlg_draw_buttons
2115 Print a list of buttons at the given position.
2116
2117 WINDOW * win
2118 is the window to update.
2119
2120 int y
2121 is the starting row.
2122
2123 int x
2124 is the starting column.
2125
2126 const char ** labels
2127 is a list of (pointers to) button labels terminated by a null
2128 pointer.
2129
2130 int selected
2131 is the index within the list of the selected button.
2132
2133 int vertical
2134 is true if the buttons are arranged in a column rather than a row.
2135
2136 int limit
2137 is the number of columns (or rows if vertical) allowed for the
2138 display.
2139
2140 dlg_draw_helpline
2141 draw the text in dialog_vars.help_line at the bottom of the given win‐
2142 dow.
2143
2144 WINDOW * dialog
2145 is the window to modify.
2146
2147 bool decorations
2148 if true, allow room for the scrolling arrows.
2149
2150 dlg_draw_scrollbar
2151 If dialog_state.use_scrollbar is set, draw a scrollbar on the right
2152 margin of windows holding scrollable data. Also (whether or not the
2153 scrollbar is drawn), annotate the bottom margin of the window with the
2154 percentage of data by the bottom of that window, and call dlg_draw_ar‐
2155 rows2 to put markers on the window showing when more data is available.
2156
2157 WINDOW * win
2158 is the window in which the data is scrolled. Because left, right,
2159 top, bottom are passed as parameters, this window can contain ad‐
2160 ditional data.
2161
2162 long first_data
2163 is the zero-based index to the first row of data in the current
2164 window.
2165
2166 long this_data
2167 is the zero-based index to the current row of data.
2168
2169 long next_data
2170 is the zero-based index to the next data after the current row.
2171
2172 long total_data
2173 is the total number of rows of data.
2174
2175 int left
2176 is the zero-based left margin/column of the window. The up/down
2177 arrows are draw inset by 5 columns from this point.
2178
2179 int right
2180 is the zero-based right margin/column of the window. The scroll‐
2181 bar is drawn flush against this column.
2182
2183 int top
2184 is the zero-based row within the window on which to draw up-arrows
2185 as well as a horizontal line to show the window's top.
2186
2187 int bottom
2188 is the zero-based row within the window on which to draw down-ar‐
2189 rows as well as a horizontal line to show the window's bottom.
2190
2191 chtype attr
2192 is the window's background attribute.
2193
2194 chtype borderattr
2195 is the window's border attribute.
2196
2197 dlg_draw_shadow
2198 Draw shadows along the right and bottom edge of a window to give it a
2199 3-dimensional look. (The height, etc., may not be the same as the win‐
2200 dow's actual values).
2201
2202 WINDOW * win
2203 is the window to update.
2204
2205 int height
2206 is the height of the window.
2207
2208 int width
2209 is the width of the window.
2210
2211 int y
2212 is the top row of the window.
2213
2214 int x
2215 is the left column of the window.
2216
2217 dlg_draw_title
2218 Draw a title centered at the top of the window.
2219
2220 WINDOW * win
2221 is the window to update.
2222
2223 const char * title
2224 is the title string to display at the top of the widget.
2225
2226 dlg_dummy_menutext
2227 This is a utility function which supports the --inputmenu option of the
2228 dialog program. If dialog_vars.input_menu is set, dialog_menu passes
2229 this pointer to dlg_menu as the rename_menutext parameter. Otherwise,
2230 it passes dlg_dummy_menutext.
2231
2232 The function should only return DLG_EXIT_ERROR.
2233
2234 DIALOG_LISTITEM * items
2235 is the list of menu items
2236
2237 int current
2238 is the index of the currently-selected item
2239
2240 char * newtext
2241 is the updated text for the menu item
2242
2243 dlg_dump_keys
2244 Write all user-defined key-bindings to the given stream, e.g., as part
2245 of dlg_create_rc.
2246
2247 FILE * fp
2248 is the stream on which to write the bindings.
2249
2250 dlg_dump_window_keys
2251 Write all user-defined key-bindings to the given stream, e.g., as part
2252 of dlg_create_rc.
2253
2254 FILE * fp
2255 is the stream on which to write the bindings.
2256
2257 WINDOW * win
2258 is the window for which bindings should be dumped. If it is null,
2259 then only built-in bindings are dumped.
2260
2261 dlg_eat_argv
2262 Remove one or more items from an argument vector.
2263
2264 int * argcp
2265 in/out parameter giving the length of the argument vector. char
2266 *** argvp in/out parameter pointing to the argument vector. int
2267 start starting index. int count number of arguments to remove.
2268
2269 dlg_edit_offset
2270 Given the character-offset in the string, returns the display-offset
2271 where dialog should position the cursor. In this context, “characters”
2272 may be multicolumn, since the string can be a multibyte character
2273 string.
2274
2275 char * string
2276 is the string to analyze
2277
2278 int offset
2279 is the character-offset
2280
2281 int x_last
2282 is a limit on the column positions that can be used, e.g., the
2283 window's size.
2284
2285 dlg_edit_string
2286 Updates the string and character-offset, given various editing charac‐
2287 ters or literal characters which are inserted at the character-offset.
2288 Returns true if an editing change was made (and the display should be
2289 updated), and false if the key was something like KEY_ENTER, which is a
2290 non-editing action outside this function.
2291
2292 char * string
2293 is the (multibyte) string to update
2294
2295 int * offset
2296 is the character-offset
2297
2298 int key
2299 is the editing key
2300
2301 int fkey
2302 is true if the editing key is a function-key
2303
2304 bool force
2305 is used in a special loop case by calling code to force the return
2306 value of this function when a function-key code 0 is passed in.
2307
2308 dlg_exit
2309 Given an internal exit code, check if the corresponding environment
2310 variable is set. If so, remap the exit code to match the environment
2311 variable. Finally call exit with the resulting exit code.
2312
2313 int code
2314 is the internal exit code, e.g., DLG_EXIT_OK, which may be
2315 remapped.
2316
2317 The dialog program uses this function to allow shell scripts to remap
2318 the exit codes so they can distinguish ESC from ERROR.
2319
2320 dlg_exitcode2s
2321 Returns the name of an exit-code, e.g., “OK” for DLG_EXIT_OK.
2322
2323 int code
2324 is an exit-code for dialog as defined in <dialog.h>.
2325
2326 dlg_exitname2n
2327 Returns an exit-code as the reverse of dlg_exitcode2n, e.g., 0
2328 (DLG_EXIT_OK) for the “OK” string.
2329
2330 const char * name
2331 is the name of an exit-code for dialog as defined in <dialog.h>
2332 but omitting the “DLG_EXIT_” prefix.
2333
2334 dlg_exit_buttoncode
2335 Map the given button index for dlg_exit_label into dialog's exit-code.
2336
2337 int button
2338 is the button index
2339
2340 dlg_exit_label
2341 Return a list of button labels. If dialog_vars.extra_button is true,
2342 return the result of dlg_ok_labels. Otherwise, return a list with the
2343 “Exit” label and (if dialog_vars.help_button is set) the “Help” button
2344 as well.
2345
2346 dlg_exiterr
2347 Quit program killing all tailboxbg widgets.
2348
2349 const char * fmt
2350 is the format of the printf-like message to write.
2351
2352 ...
2353 are the variables to apply to the fmt format.
2354
2355 dlg_find_index
2356 Given the character-offset to find in the list, return the correspond‐
2357 ing array index.
2358
2359 const int *list
2360 contains a list of character-offsets, i.e., indices into a string
2361 that denote the beginning of multibyte characters.
2362
2363 int limit
2364 is the last index into list to search.
2365
2366 int to_find
2367 is the character-offset to find.
2368
2369 dlg_finish_string
2370 If DIALOG_STATE.finish_string is true, this function discards data used
2371 to speed up layout computations.
2372
2373 const char * string
2374 is the address of the string whose data should be discarded. The
2375 address rather than contents is used as the unique identifier be‐
2376 cause some of the caching is used for editable input-fields.
2377
2378 dlg_flush_getc
2379 Cancel the local data saved by dlg_last_getc.
2380
2381 dlg_editbox
2382 This entrypoint provides the --editbox functionality without the limi‐
2383 tations of dialog's command-line syntax (compare to dialog_editbox).
2384
2385 const char * title
2386 is the title string to display at the top of the widget.
2387
2388 char *** list
2389 is a pointer to an array of char * pointers. The array is allo‐
2390 cated by the caller, and so are the strings to which it points.
2391 The dlg_editbox function may reallocate the array and the strings.
2392
2393 int * rows
2394 points to the nominal length of list. The referenced value is up‐
2395 dated iflist is reallocated.
2396
2397 int height
2398 is the desired height of the box. If zero, the height is adjusted
2399 to use the available screen size.
2400
2401 int width
2402 is the desired width of the box. If zero, the height is adjusted
2403 to use the available screen size.
2404
2405 dlg_form
2406 This entrypoint provides the --form functionality without the limita‐
2407 tions of dialog's command-line syntax (compare to dialog_form).
2408
2409 const char * title
2410 is the title string to display at the top of the widget.
2411
2412 const char * cprompt
2413 is the prompt text shown within the widget.
2414
2415 int height
2416 is the desired height of the box. If zero, the height is adjusted
2417 to use the available screen size.
2418
2419 int width
2420 is the desired width of the box. If zero, the height is adjusted
2421 to use the available screen size.
2422
2423 int form_height
2424 is the minimum height to reserve for displaying the list. If
2425 zero, it is computed based on the given height and width.
2426
2427 int item_no
2428 is the number of items.
2429
2430 DIALOG_FORMITEM * items
2431 This is a list of the items to display in the form.
2432
2433 int * current_item
2434 The widget sets the referenced location to the index of the cur‐
2435 rent display item (cursor) when it returns.
2436
2437 dlg_free_columns
2438 Free data allocated by dlg_align_columns.
2439
2440 char **target
2441 This is the array which was reformatted. It points to the first
2442 string to free.
2443
2444 int per_row
2445 This is the size of the struct for each row of the array.
2446
2447 int num_rows
2448 This is the number of rows in the array.
2449
2450 dlg_free_formitems
2451 Free memory owned by a list of DIALOG_FORMITEM's.
2452
2453 DIALOG_FORMITEM * items
2454 is the list to free.
2455
2456 dlg_free_gauge
2457 Remove the gauge widget from the screen and free its associated memory.
2458
2459 void *objptr
2460 points to the gauge widget.
2461
2462 dlg_getc
2463 Read a character from the given window. Handle repainting here (to
2464 simplify things in the calling application). Also, if input-call‐
2465 back(s) are set up, poll the corresponding files and handle the up‐
2466 dates, e.g., for displaying a tailbox. Returns the key-code.
2467
2468 WINDOW * win
2469 is the window within which to read.
2470
2471 int * fkey
2472 as a side-effect, set this to true if the key-code is really a
2473 function-key.
2474
2475 dlg_getenv_num
2476 Get a number from the environment:
2477
2478 • If the caller provides a pointer in the second parameter, return
2479 success/failure for the function return, and the actual value via
2480 the pointer. Use this for decoding arbitrary numbers, e.g., nega‐
2481 tive or zero.
2482
2483 • If the caller does not provide a pointer, return the decoded value
2484 for the function-return. Use this when only values greater than
2485 zero are useful.
2486
2487 char * name
2488 is the name of the environment-variable to retrieve.
2489
2490 int * value
2491 is the optional pointer to a return-value.
2492
2493 dlg_getenv_str
2494 Get a string from the environment, rejecting those which are entirely
2495 blank.
2496
2497 char * name
2498 is the name of the environment-variable to retrieve.
2499
2500 dlg_get_attrs
2501 extract the video attributes from the given window.
2502
2503 WINDOW * win
2504 is the window from which to get attributes.
2505
2506 dlg_getc_callbacks
2507 passes the given key-code ch to the current window that has established
2508 a callback. If the callback returns zero, remove it and try the next
2509 window. If no more callbacks remain, return. If any callbacks were
2510 found, return true, otherwise false.
2511
2512 int ch
2513 is the key-code
2514
2515 int fkey
2516 is true if the key is a function-key
2517
2518 int * result
2519 is used to pass an exit-code to the caller, which should pass that
2520 via dlg_exit.
2521
2522 dlg_index_columns
2523 Build a list of the display-columns for the given multibyte string's
2524 characters.
2525
2526 const char * string
2527 is the string to analyze
2528
2529 dlg_index_wchars
2530 Build an index of the wide-characters in the string, so the caller can
2531 easily tell which byte-offset begins a given wide-character.
2532
2533 const char * string
2534 is the string to analyze
2535
2536 dlg_item_help
2537 Draw the string for the dialog_vars.item_help feature.
2538
2539 const char * txt
2540 is the help-message
2541
2542 dlg_keep_tite
2543 This performs the check and modifications for the command-line option
2544 "--keep-tite", used in init_dialog as well as for the command-line op‐
2545 tion --erase-on-exit.
2546
2547 FILE * output
2548 is the output stream used for displaying widgets. It is either
2549 stdout or stderr, depending on the --stdout option.
2550
2551 dlg_killall_bg
2552 If dialog has callbacks active, purge the list of all that are not
2553 marked to keep in the background. If any remain, run those in a back‐
2554 ground process.
2555
2556 int * retval
2557 stores the exit-code to pass back to the caller.
2558
2559 dlg_last_getc
2560 returns the most recent character that was read via dlg_getc.
2561
2562 dlg_limit_columns
2563 Given a column limit, count the number of wide characters that can fit
2564 into that limit. The offset is used to skip over a leading character
2565 that was already written.
2566
2567 const char * string
2568 is the string to analyze
2569
2570 int limit
2571 is the column limit
2572
2573 int offset
2574 is the starting offset from which analysis should continue
2575
2576 dlg_lookup_key
2577 Check for a key-binding. If there is no binding associated with the
2578 widget, it simply returns the given curses-key. Otherwise, it returns
2579 the result of the binding
2580
2581 WINDOW * win
2582 is the window on which the binding is checked
2583
2584 int curses_key
2585 is the curses key-code
2586
2587 int * dialog_key
2588 is the corresponding dialog internal code (see DLG_KEYS_ENUM in
2589 dlg_key.h).
2590
2591 dlg_max_input
2592 Limit the parameter according to dialog_vars.max_input
2593
2594 int max_len
2595 is the value to limit
2596
2597 dlg_match_char
2598 Match a given character against the beginning of the string, ignoring
2599 case of the given character. The matching string must begin with an
2600 uppercase character.
2601
2602 int ch
2603 is the character to check
2604
2605 const char * string
2606 is the string to search
2607
2608 dlg_menu
2609 This entrypoint provides the --menu functionality without the limita‐
2610 tions of dialog's command-line syntax (compare to dialog_menu).
2611
2612 const char * title
2613 is the title string to display at the top of the widget.
2614
2615 const char * cprompt
2616 is the prompt text shown within the widget.
2617
2618 int height
2619 is the desired height of the box. If zero, the height is adjusted
2620 to use the available screen size.
2621
2622 int width
2623 is the desired width of the box. If zero, the height is adjusted
2624 to use the available screen size.
2625
2626 int menu_height
2627 is the minimum height to reserve for displaying the list. If
2628 zero, it is computed based on the given height and width.
2629
2630 int item_no
2631 is the number of items.
2632
2633 DIALOG_LISTITEM * items
2634 This is a list of the items to display in the form.
2635
2636 int * current_item
2637 The widget sets the referenced location to the index of the cur‐
2638 rent display item (cursor) when it returns.
2639
2640 DIALOG_INPUTMENU rename_menutext
2641 If this is not dlg_dummy_menutext, the widget acts like an input‐
2642 menu widget, providing an extra “Rename” button, which activates
2643 an edit feature on the selected menu item.
2644
2645 dlg_move_window
2646 Moves/resizes the given window to the given position and size.
2647
2648 WINDOW *win
2649 is the window to move/resize.
2650
2651 WINDOW *height
2652 is the height of the resized window.
2653
2654 WINDOW *width
2655 is the width of the resized window.
2656
2657 WINDOW *y
2658 y-ordinate to use for the repositioned window.
2659
2660 WINDOW *x
2661 x-ordinate to use for the repositioned window.
2662
2663 dlg_mouse_bigregion
2664 Retrieve the big-region under the pointer.
2665
2666 int y
2667 is the row on which the mouse click occurred
2668
2669 int x
2670 is the column on which the mouse click occurred
2671
2672 dlg_mouse_free_regions
2673 Free the memory associated with mouse regions.
2674
2675 dlg_mouse_mkbigregion
2676 Creates a region on which the mouse-clicks will return a specified
2677 code.
2678
2679 int y
2680 is the top-row of the region.
2681
2682 int x
2683 is the left-column of the region.
2684
2685 int height
2686 is the height of the region.
2687
2688 int width
2689 is the width of the region.
2690
2691 int code
2692 is a code used to make the region unique within a widget
2693
2694 int step_x
2695 is used in modes 2 (columns) and 3 (cells) to determine the width
2696 of a column/cell.
2697
2698 int step_y
2699 is currently unused
2700
2701 int mode
2702 is used to determine how the mouse position is translated into a
2703 code (like a function-key):
2704
2705 1 index by lines
2706
2707 2 index by columns
2708
2709 3 index by cells
2710
2711 dlg_mouse_mkregion
2712 int y
2713 is the top-row of the region.
2714
2715 int x
2716 is the left-column of the region.
2717
2718 int height
2719 is the height of the region.
2720
2721 int width
2722 is the width of the region.
2723
2724 int code
2725 is a code used to make the region unique within a widget
2726
2727 dlg_mouse_region
2728 Retrieve the frame under the mouse pointer
2729
2730 int y
2731 is the row of the mouse-click
2732
2733 int x
2734 is the column of the mouse-click
2735
2736 dlg_mouse_setbase
2737 Sets a base for subsequent calls to dlg_mouse_mkregion, so they can
2738 make regions relative to the start of a given window.
2739
2740 int x
2741 is the left-column for the base
2742
2743 int y
2744 is the top-row for the base
2745
2746 dlg_mouse_setcode
2747 Sets a value used internally by dlg_mouse_mkregion which is added to
2748 the code parameter. By providing different values, e.g., multiples of
2749 KEY_MAX, it is possible to support multiple “big” regions in a widget.
2750 The buildlist widget uses this feature to recognize mouse-clicks in the
2751 left/right panes.
2752
2753 int code
2754 is the value to add to dlg_mouse_mkregion's code parameter.
2755
2756 dlg_mouse_wgetch
2757 is a wrapper for dlg_getc which additionally maps mouse-clicks (if the
2758 curses library supports those) into extended function-keys which encode
2759 the position according to the mode in dlg_mouse_mkbigregion. Returns
2760 the corresponding key-code.
2761
2762 WINDOW * win
2763 is the window on which to perform the input
2764
2765 int * fkey
2766 the referenced location is set to true if the key-code is an ac‐
2767 tual or extended (mouse) function-key.
2768
2769 dlg_mouse_wgetch_nowait
2770 This is a non-blocking variant of dlg_mouse_wgetch.
2771
2772 WINDOW * win
2773 is the window on which to perform the input
2774
2775 int * fkey
2776 the referenced location is set to true if the key-code is an ac‐
2777 tual or extended (mouse) function-key.
2778
2779 dlg_need_separator
2780 Check if an output-separator is needed. If dialog_vars.output_separa‐
2781 tor is set, return true. Otherwise, if dialog_vars.input_result is
2782 nonempty, return true. If neither, return false.
2783
2784 dlg_new_modal_window
2785 Create a modal window, optionally with a shadow. The shadow is created
2786 if dialog_state.use_shadow is true.
2787
2788 WINDOW * parent
2789 is the parent window (usually the top-level window of a widget)
2790
2791 int height
2792 is the window's height
2793
2794 int width
2795 is the window's width
2796
2797 int y
2798 is the window's top-row
2799
2800 int x
2801 is the window's left-column
2802
2803 dlg_new_window
2804 Create a window, optionally with a shadow. The shadow is created if
2805 dialog_state.use_shadow is true.
2806
2807 int height
2808 is the window's height
2809
2810 int width
2811 is the window's width
2812
2813 int y
2814 is the window's top-row
2815
2816 int x
2817 is the window's left-column
2818
2819 dlg_next_button
2820 Return the next index in the list of labels.
2821
2822 const char ** labels
2823 is a list of (pointers to) button labels terminated by a null
2824 pointer.
2825
2826 int button
2827 is the current button-index.
2828
2829 dlg_next_ok_buttonindex
2830 Assuming that the caller is using dlg_ok_labels to list buttons, find
2831 the next index in the list of buttons.
2832
2833 int current
2834 is the current index in the list of buttons
2835
2836 int extra
2837 if negative, provides a way to enumerate extra active areas on the
2838 widget.
2839
2840 dlg_ok_buttoncode
2841 Map the given button index for dlg_ok_labels into dialog's exit-code.
2842
2843 int button
2844 is the button-index (which is not necessarily the same as the in‐
2845 dex in the list of labels).
2846
2847 dlg_ok_button_key
2848 Calls dlg_button_key with the “Cancel” button disabled, e.g., for the
2849 textbox widget.
2850
2851 dlg_ok_label
2852 Returns a list with the “Ok” label, and if dialog_vars.help_button is
2853 true, the “Help” label as well.
2854
2855 dlg_ok_labels
2856 Return a list of button labels for the OK/Cancel group of widgets.
2857
2858 dlg_ordinate
2859 Decode the string as an integer, decrement if greater than zero to make
2860 a curses-ordinate from a dialog-ordinate.
2861
2862 dlg_parse_bindkey
2863 Parse the parameters of the “bindkeys” configuration-file entry. This
2864 expects widget name which may be "*", followed by curses key definition
2865 and then dialog key definition.
2866
2867 char * params
2868 is the parameter string to parse.
2869
2870 dlg_parse_rc
2871 Parse the configuration file and set up variables.
2872
2873 dlg_popen
2874 Open a pipe which ties the standard error and output together. The
2875 popen function captures only the standard output of a command.
2876
2877 const char *command
2878 The shell command to run.
2879
2880 const char *type
2881 Like popen, "r" is used to read, and "w" is used to write.
2882
2883 dlg_prev_button
2884 Return the previous index in the list of labels.
2885
2886 const char ** labels
2887 is a list of (pointers to) button labels terminated by a null
2888 pointer.
2889
2890 int button
2891 is the current button index
2892
2893 dlg_print_listitem
2894 This is a helper function used for the various “list” widgets, e.g.,
2895 checklist, menu, buildlist, treeview. Each list-widget has “tag” and
2896 “description” values for each item which can be displayed. If dia‐
2897 log_vars.no_tags is true, the “tag” value is not shown. The first
2898 character of the first value shown (tag or description) is highlighted
2899 to indicate that the widget will match it for quick navigation.
2900
2901 WINDOW *win
2902 the window in which to display the text
2903
2904 const char *text
2905 the value to display
2906
2907 int climit
2908 the number of columns available for printing the text
2909
2910 bool first
2911 true if this is the first call (for “tag” and “description”), and
2912 the first character of the value should be highlighted.
2913
2914 int selected
2915 nonzero if the text should be displayed using the “selected” col‐
2916 ors
2917
2918 dlg_print_scrolled
2919 This is a wrapper for dlg_print_autowrap which allows the user to
2920 scroll too-long prompt text up/down.
2921
2922 See dlg_check_scrolled for a function which updates the offset variable
2923 used as a parameter here. It complements this function; you need both.
2924 If pauseopt is set, this function returns an updated last parameter,
2925 needed for dlg_check_scrolled calls.
2926
2927 WINDOW * win
2928 is the window to update.
2929
2930 const char * prompt
2931 is the string to print
2932
2933 int offset
2934 is the starting line-number to write wrapped text.
2935
2936 int height
2937 is the available height for writing the wrapped text
2938
2939 int width
2940 is the width that the wrapping should occur in
2941
2942 int pauseopt
2943 is true if the extra functionality for scrolling should be en‐
2944 abled. If false, this calls dlg_print_autowrap without doing any
2945 scrolling.
2946
2947 dlg_print_line
2948 Print one line of the prompt in the window within the limits of the
2949 specified right margin. The line will end on a word boundary and a
2950 pointer to the start of the next line is returned, or a NULL pointer if
2951 the end of *prompt is reached.
2952
2953 WINDOW *win
2954 is the window to update.
2955
2956 chtype *attr
2957 holds the starting attributes, and is updated to reflect the final
2958 attributes applied to the string.
2959
2960 const char *prompt
2961 is the string to print
2962
2963 int lm
2964 is the left margin.
2965
2966 int rm
2967 is the right margin
2968
2969 int *x
2970 returns the ending x-ordinate.
2971
2972 dlg_prev_ok_buttonindex
2973 Find the previous button index in the list from dlg_ok_labels.
2974
2975 int current
2976 is the current index
2977
2978 int extra
2979 if negative provides a way to enumerate extra active areas on the
2980 widget.
2981
2982 dlg_print_autowrap
2983 Print a string of text in a window, automatically wrap around to the
2984 next line if the string is too long to fit on one line. Note that the
2985 string may contain embedded newlines. The text is written starting at
2986 the top of the window.
2987
2988 WINDOW * win
2989 is the window to update.
2990
2991 const char * prompt
2992 is the string to print
2993
2994 int height
2995 is the nominal height the wrapped string is limited to
2996
2997 int width
2998 is the width that the wrapping should occur in
2999
3000 dlg_print_size
3001 If dialog_vars.print_siz is true, print the given height/width (from a
3002 widget) to dialog_state.output, e.g., Size: height, width.
3003
3004 int height
3005 is the window's height
3006
3007 int width
3008 is the window's width
3009
3010 dlg_print_text
3011 Print up to cols columns from text, optionally rendering dialog's es‐
3012 cape sequences for attributes and color.
3013
3014 WINDOW * win
3015 is the window to update.
3016
3017 const char * txt
3018 is the string to print
3019
3020 int col
3021 is the column limit
3022
3023 chtype * attr
3024 holds the starting attributes, and is updated to reflect the final
3025 attributes applied to the string.
3026
3027 dlg_progressbox
3028 implements the "--prgbox" and "--progressbox" options.
3029
3030 const char * title
3031 is the title on the top of the widget.
3032
3033 const char * cprompt
3034 is the prompt text shown within the widget. If empty or null, no
3035 prompt is shown.
3036
3037 int height
3038 is the desired height of the box. If zero, the height is based on
3039 the screen size.
3040
3041 int width
3042 is the desired width of the box. If zero, the height is based on
3043 the screen size.
3044
3045 int pauseopt
3046 if true, an “OK” button will be shown, and the dialog will wait
3047 for it to complete. With an “OK” button, it is denoted a “pro‐
3048 grambox”, without an “OK” button, it is denoted a “progressbox”.
3049
3050 FILE * fp
3051 is the file pointer, which may be a pipe or a regular file.
3052
3053 dlg_put_backtitle
3054 Display the background title if dialog_vars.backtitle is non-null. The
3055 background title is shown at the top of the screen.
3056
3057 dlg_reallocate_gauge
3058 Allocates or reallocates a gauge widget (see dlg_allocate_gauge). Use
3059 dlg_update_gauge to display the result.
3060
3061 void ** objptr
3062 If the pointer referenced by this parameter is null, the function
3063 creates a new gauge widget using dlg_allocate_gauge. Otherwise,
3064 it updates the title and cprompt values, reusing the window from
3065 the previous call on this function. As a side-effect, the func‐
3066 tion stores the updated object-pointer via the objptr parameter.
3067
3068 const char * title
3069 is the title string to display at the top of the widget.
3070
3071 const char * cprompt
3072 is the prompt text shown within the widget.
3073
3074 int height
3075 is the desired height of the box. If zero, the height is adjusted
3076 to use the available screen size.
3077
3078 int width
3079 is the desired width of the box. If zero, the height is adjusted
3080 to use the available screen size.
3081
3082 int percent
3083 is the percentage to show in the progress bar.
3084
3085 dlg_register_buttons
3086 The widget developer should call this function after dlg_register_win‐
3087 dow, for the list of button labels associated with the widget. One may
3088 bind a key to a button, e.g., “OK” for DLGK_OK,
3089
3090 WINDOW * win
3091 is the window with which to associate the buttons
3092
3093 const char * name
3094 is the widget's binding name (usually the name of the widget).
3095
3096 const char ** buttons
3097 is the list of buttons
3098
3099 dlg_register_window
3100 For a given named widget's window, associate a binding table.
3101
3102 WINDOW * win
3103 is the window with which to associate the buttons
3104
3105 const char * name
3106 is the widget's binding name (usually the name of the widget).
3107
3108 DLG_KEYS_BINDING * binding
3109 is the binding table
3110
3111 dlg_remove_callback
3112 Remove a callback.
3113
3114 DIALOG_CALLBACK * p
3115 contains the callback information.
3116
3117 dlg_renamed_menutext
3118 This is a utility function which supports the --inputmenu option of the
3119 dialog program. If dialog_vars.input_menu is set, dialog_menu passes
3120 this pointer to dlg_menu as the rename_menutext parameter. Otherwise,
3121 it passes dlg_dummy_menutext.
3122
3123 The function should add “RENAMED” to dialog_vars.input_result , fol‐
3124 lowed by the menu item's name and the newtext value (with a space sepa‐
3125 rating the three items), and return DLG_EXIT_EXTRA.
3126
3127 DIALOG_LISTITEM * items
3128 is the list of menu items
3129
3130 int current
3131 is the index of the currently-selected item
3132
3133 char * newtext
3134 is the updated text for the menu item
3135
3136 dlg_reset_timeout
3137 Calls wtimeout with the value saved for a window in the last call to
3138 dlg_set_timeout.
3139
3140 dlg_restore_vars
3141 Restore dialog's variables from the given variable (see dia‐
3142 log_save_vars).
3143
3144 DIALOG_VARS * save
3145 is the variable from which to restore.
3146
3147 The DIALOG_VARS.input_length and DIALOG_VARS.input_result members are
3148 treated specially, since these are used by a widget to pass data to the
3149 caller. They are not modified by this function.
3150
3151 dlg_result_key
3152 Test a dialog internal keycode to see if it corresponds to one of the
3153 push buttons on the widget such as “OK”. This is only useful if there
3154 are user-defined key bindings, since there are no built-in bindings
3155 that map directly to DLGK_OK, etc. Return true if a mapping was done.
3156
3157 int dialog_key
3158 is the dialog key to test
3159
3160 int fkey
3161 is true if this is a function key
3162
3163 int * resultp
3164 store the result of the mapping in the referenced location.
3165
3166 dlg_save_vars
3167 Save dialog's variables into the given variable (see dlg_restore_vars).
3168
3169 DIALOG_VARS * save
3170 is the variable into which to save.
3171
3172 dlg_set_focus
3173 Set focus on the given window, making it display above other windows on
3174 the screen.
3175
3176 WINDOW * parent
3177 is the parent window (usually the top-level window of a widget)
3178
3179 WINDOW * win
3180 is the window on which to place focus (usually a subwindow of a
3181 widget)
3182
3183 dlg_set_result
3184 Setup a fixed-buffer for the result in dialog_vars.input_result
3185
3186 const char * string
3187 is the new contents for the result
3188
3189 dlg_set_timeout
3190 Calls wtimeout to establish a preferred timeout for nonblocking reads,
3191 e.g., to allow the gauge widget to handle window-resizing events. The
3192 dlg_may_resize function temporarily overrides this value, to allow it
3193 to skip over the error codes returned while the ncurses library pro‐
3194 cesses window-resizing events. It restores the value established in
3195 this call by calling dlg_restore_timeout.
3196
3197 WINDOW * win
3198 is the window whose input-timeout should be set
3199
3200 bool will_getc
3201 is true if the widget is expected to read keyboard characters.
3202 Some (such as the gauge widget) do not.
3203
3204 dlg_show_string
3205 Displays the string, shifted as necessary, to fit within the box and
3206 show the current character-offset.
3207
3208 WINDOW * win
3209 is the window within which to display
3210
3211 const char * string
3212 is the string to display
3213
3214 int offset
3215 is the starting (character, not bytes) offset
3216
3217 chtype attr
3218 is the window attribute to use for the string
3219
3220 int y_base
3221 beginning row on screen
3222
3223 int x_base
3224 beginning column on screen
3225
3226 int x_last
3227 number of columns on screen
3228
3229 bool hidden
3230 if true, do not echo input
3231
3232 bool force
3233 if true, force repaint
3234
3235 dlg_strclone
3236 duplicate the string, like strdup.
3237
3238 const char * cprompt
3239 is the string to duplicate
3240
3241 dlg_strcmp
3242 compare two strings, ignoring case.
3243
3244 const char * a
3245 is one string
3246
3247 const char * b
3248 is the other string
3249
3250 dlg_string_to_argv
3251 Convert a string to an argument vector returning an index (which must
3252 be freed by the caller). The string is modified:
3253
3254 • Blanks between arguments are replaced by nulls.
3255
3256 • Normally arguments are separated by blanks; however you can double-
3257 quote an argument to enclose blanks. The surrounding double-quotes
3258 are removed from the string.
3259
3260 • A backslash preceding a double-quote within double-quotes is re‐
3261 moved.
3262
3263 • A backslash preceding a newline outside double-quotes is removed.
3264
3265 • Except for special cases, backslashes are preserved in the strings,
3266 since other dialog functions interpret backslashes, e.g., for col‐
3267 ors.
3268
3269 char *blob
3270 is the string to convert.
3271
3272 dlg_sub_window
3273 create a subwindow, e.g., for an input area of a widget
3274
3275 WINDOW * win
3276 is the parent window
3277
3278 int height
3279 is the subwindow's height
3280
3281 int width
3282 is the subwindow's width
3283
3284 int y
3285 is the subwindow's top-row
3286
3287 int x
3288 is the subwindow's left-column
3289
3290 dlg_tab_correct_str
3291 If the dialog_vars.tab_correct is true, convert tabs to single spaces.
3292 Return the converted result. The caller is responsible for freeing the
3293 string.
3294
3295 char * prompt
3296 is the string to convert
3297
3298 dlg_trace
3299 If the parameter is non-null, opens a trace file with that name and
3300 stores the file pointer in dialog_state.trace.
3301
3302 dlg_trace_2n
3303 logs a numeric value as a comment.
3304
3305 char * name
3306 is the name to log in the comment.
3307
3308 int value
3309 is the value to log in the comment.
3310
3311 dlg_trace_2s
3312 logs a string value as a comment. If the value contains embedded new‐
3313 lines, the comment is continued with “#+” markers.
3314
3315 char * name
3316 is the name to log in the comment.
3317
3318 int value
3319 is the value to log in the comment.
3320
3321 dlg_trace_chr
3322 If dialog_state.trace is set, translate the parameters into a printable
3323 representation, log it on a “chr” line.
3324
3325 int ch
3326 is the nominal keycode value.
3327
3328 int fkey
3329 is nonzero if the value is really a function key. Some of these
3330 may be values declared in the DLG_KEYS_ENUM.
3331
3332 dlg_trace_msg
3333 Write a formatted message to the trace file.
3334
3335 const char * fmt
3336 is the format of the printf-like message to write.
3337
3338 ...
3339 are the variables to apply to the fmt format.
3340
3341 Use the DLG_TRACE macro for portability, in case the trace feature is
3342 not compiled into the library. It uses an extra level of parentheses
3343 to work with a variable number of parameters, e.g.,
3344
3345 DLG_TRACE(("this is dialog version %s\n", dialog_version()));
3346
3347 dlg_trace_va_msg
3348 Write a formatted message to the trace file.
3349
3350 const char *fmt
3351 is the format of the printf-like message to write.
3352
3353 va_list ap
3354 are the variables to apply to the fmt format.
3355
3356 This is used in dlg_exiterr to capture error messages in the trace
3357 file:
3358
3359 va_start(ap, fmt);
3360 dlg_trace_msg("## Error: ");
3361 dlg_trace_va_msg(fmt, ap);
3362 va_end(ap);
3363
3364 Unlike dlg_trace_msg, an extra macro is not needed.
3365
3366 dlg_ttysize
3367 Returns the screensize without using curses. That allows the function
3368 to be used before initializing the screen.
3369
3370 dlg_trace_win
3371 If dialog_state.trace is set, log a printable picture of the given win‐
3372 dow.
3373
3374 dlg_treeview
3375 This is an alternate interface to 'treeview' which allows the applica‐
3376 tion to read the list item states back directly without putting them in
3377 the output buffer.
3378
3379 const char * title
3380 is the title on the top of the widget.
3381
3382 const char * cprompt
3383 is the prompt text shown within the widget.
3384
3385 int height
3386 is the desired height of the box. If zero, the height is based on
3387 the screen size.
3388
3389 int width
3390 is the desired width of the box. If zero, the height is based on
3391 the screen size.
3392
3393 int list_height
3394 is the minimum height to reserve for displaying the list. If
3395 zero, it is computed based on the given height and width.
3396
3397 int item_no
3398 is the number of rows in items.
3399
3400 DIALOG_LISTITEM * items
3401 is the list of items, contain tag, name, and optionally help
3402 strings (if dialog_vars.item_help is set). The initial selection
3403 state for each item is also in this list.
3404
3405 const char * states
3406 This is a list of characters to display for the given states.
3407 Normally a buildlist provides true (1) and false (0) values, which
3408 the widget displays as "*" and space, respectively. An applica‐
3409 tion may set this parameter to an arbitrary null-terminated
3410 string. The widget determines the number of states from the
3411 length of this string, and will cycle through the corresponding
3412 display characters as the user presses the space-bar.
3413
3414 int * depths
3415 This is a list of depths of each item in the tree. It is a sepa‐
3416 rate parameter from items to allow reuse of the existing func‐
3417 tions.
3418
3419 int flag
3420 is either FLAG_CHECK, for checklists (multiple selections), or
3421 FLAG_RADIO for radiolists (a single selection).
3422
3423 int * current_item
3424 The widget sets the referenced location to the index of the cur‐
3425 rent display item (cursor) when it returns.
3426
3427 dlg_trim_string
3428 The dialog program uses this in each widget to adjust the message
3429 string, which may contain the newline character (referred to as '\n')
3430 and/or the special substring "\n" (which can be translated into a new‐
3431 line character).
3432
3433 There are several optional features:
3434
3435 • Unless dialog_vars.nocollapse is set, each tab is converted to a
3436 space before other processing.
3437
3438 • If dialog_vars.no_nl_expand is not set, and the string has "\n"
3439 substrings:
3440
3441 • The function changes embedded "\n" substrings to '\n' charac‐
3442 ters.
3443
3444 The function preserves extra spaces after these substitutions.
3445 For instance, spaces following a newline (substring or charac‐
3446 ter) are preserved to use as an indentation.
3447
3448 • If dialog_vars.cr_wrap is set, the function preserves '\n' new‐
3449 line characters. Otherwise, each '\n' newline character is
3450 converted to a space.
3451
3452 • Otherwise, if dialog_vars.trim_whitespace is set:
3453
3454 • This function strips all extra spaces to simplify justifica‐
3455 tion.
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 • Finally (if dialog_vars.no_nl_expand is set, or the string does not
3462 contain "\n" substrings, and dialog_vars.trim_whitespace is not
3463 set):
3464
3465 • Unless dialog_vars.nocollapse is set, sequences of spaces are
3466 reduced to a single space.
3467
3468 char * src
3469 is the string to trim
3470
3471 dlg_unregister_window
3472 Remove the bindings for a given window.
3473
3474 WINDOW * win
3475 is the window from which to remove bindings
3476
3477 dlg_update_gauge
3478 Update a gauge widget to show a different percentage value.
3479
3480 void *objptr
3481 points to the gauge object to update.
3482
3483 int percent
3484 is the new percentage value to display.
3485
3486 dlg_will_resize
3487 This filters out bursts of KEY_RESIZE values. Call this after dlg_getc
3488 returns KEY_RESIZE, to improve performance.
3489
3490 dlg_yes_buttoncode
3491 Map the given button index for dlg_yes_labels into dialog's exit-code.
3492
3493 int button
3494 is the button index
3495
3496 dlg_yes_labels
3497 Return a list of buttons for Yes/No labels.
3498
3499 end_dialog
3500 End use of dialog functions.
3501
3502 init_dialog
3503 Do some initialization for dialog.
3504
3505 FILE *input
3506 is the real tty input of dialog. Usually it is the standard in‐
3507 put, but if --input-fd option is used, it may be anything.
3508
3509 FILE *output
3510 is where dialog will send its result. Usually it is the standard
3511 error, but if --stdout or --output-fd is used, it may be anything.
3512
3514 dialog (1).
3515
3517 Thomas E. Dickey
3518
3519
3520
3521$Date: 2021/01/17 18:02:44 $ DIALOG(3)