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