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
2618
2619 dlg_match_char
2620 Match a given character against the beginning of the string, ignoring
2621 case of the given character. The matching string must begin with an
2622 uppercase character.
2623
2624 int ch
2625 is the character to check
2626
2627 const char * string
2628 is the string to search
2629
2630 dlg_menu
2631 This entrypoint provides the --menu functionality without the limita‐
2632 tions of dialog's command-line syntax (compare to dialog_menu).
2633
2634 const char * title
2635 is the title string to display at the top of the widget.
2636
2637 const char * cprompt
2638 is the prompt text shown within the widget.
2639
2640 int height
2641 is the desired height of the box. If zero, the height is adjusted
2642 to use the available screen size.
2643
2644 int width
2645 is the desired width of the box. If zero, the height is adjusted
2646 to use the available screen size.
2647
2648 int menu_height
2649 is the minimum height to reserve for displaying the list. If
2650 zero, it is computed based on the given height and width.
2651
2652 int item_no
2653 is the number of items.
2654
2655 DIALOG_LISTITEM * items
2656 This is a list of the items to display in the form.
2657
2658 int * current_item
2659 The widget sets the referenced location to the index of the cur‐
2660 rent display item (cursor) when it returns.
2661
2662 DIALOG_INPUTMENU rename_menutext
2663 If this is not dlg_dummy_menutext, the widget acts like an input‐
2664 menu widget, providing an extra “Rename” button, which activates
2665 an edit feature on the selected menu item.
2666
2667 dlg_move_window
2668 Moves/resizes the given window to the given position and size.
2669
2670 WINDOW *win
2671 is the window to move/resize.
2672
2673 WINDOW *height
2674 is the height of the resized window.
2675
2676 WINDOW *width
2677 is the width of the resized window.
2678
2679 WINDOW *y
2680 y-ordinate to use for the repositioned window.
2681
2682 WINDOW *x
2683 x-ordinate to use for the repositioned window.
2684
2685 dlg_mouse_bigregion
2686 Retrieve the big-region under the pointer.
2687
2688 int y
2689 is the row on which the mouse click occurred
2690
2691 int x
2692 is the column on which the mouse click occurred
2693
2694 dlg_mouse_free_regions
2695 Free the memory associated with mouse regions.
2696
2697 dlg_mouse_mkbigregion
2698 Creates a region on which the mouse-clicks will return a specified
2699 code.
2700
2701 int y
2702 is the top-row of the region.
2703
2704 int x
2705 is the left-column of the region.
2706
2707 int height
2708 is the height of the region.
2709
2710 int width
2711 is the width of the region.
2712
2713 int code
2714 is a code used to make the region unique within a widget
2715
2716 int step_x
2717 is used in modes 2 (columns) and 3 (cells) to determine the width
2718 of a column/cell.
2719
2720 int step_y
2721 is currently unused
2722
2723 int mode
2724 is used to determine how the mouse position is translated into a
2725 code (like a function-key):
2726
2727 1 index by lines
2728
2729 2 index by columns
2730
2731 3 index by cells
2732
2733 dlg_mouse_mkregion
2734 int y
2735 is the top-row of the region.
2736
2737 int x
2738 is the left-column of the region.
2739
2740 int height
2741 is the height of the region.
2742
2743 int width
2744 is the width of the region.
2745
2746 int code
2747 is a code used to make the region unique within a widget
2748
2749 dlg_mouse_region
2750 Retrieve the frame under the mouse pointer
2751
2752 int y
2753 is the row of the mouse-click
2754
2755 int x
2756 is the column of the mouse-click
2757
2758 dlg_mouse_setbase
2759 Sets a base for subsequent calls to dlg_mouse_mkregion, so they can
2760 make regions relative to the start of a given window.
2761
2762 int x
2763 is the left-column for the base
2764
2765 int y
2766 is the top-row for the base
2767
2768 dlg_mouse_setcode
2769 Sets a value used internally by dlg_mouse_mkregion which is added to
2770 the code parameter. By providing different values, e.g., multiples of
2771 KEY_MAX, it is possible to support multiple “big” regions in a widget.
2772 The buildlist widget uses this feature to recognize mouse-clicks in the
2773 left/right panes.
2774
2775 int code
2776 is the value to add to dlg_mouse_mkregion's code parameter.
2777
2778 dlg_mouse_wgetch
2779 is a wrapper for dlg_getc which additionally maps mouse-clicks (if the
2780 curses library supports those) into extended function-keys which encode
2781 the position according to the mode in dlg_mouse_mkbigregion. Returns
2782 the corresponding key-code.
2783
2784 WINDOW * win
2785 is the window on which to perform the input
2786
2787 int * fkey
2788 the referenced location is set to true if the key-code is an ac‐
2789 tual or extended (mouse) function-key.
2790
2791 dlg_mouse_wgetch_nowait
2792 This is a non-blocking variant of dlg_mouse_wgetch.
2793
2794 WINDOW * win
2795 is the window on which to perform the input
2796
2797 int * fkey
2798 the referenced location is set to true if the key-code is an ac‐
2799 tual or extended (mouse) function-key.
2800
2801 dlg_need_separator
2802 Check if an output-separator is needed. If dialog_vars.output_separa‐
2803 tor is set, return true. Otherwise, if dialog_vars.input_result is
2804 nonempty, return true. If neither, return false.
2805
2806 dlg_new_modal_window
2807 Create a modal window, optionally with a shadow. The shadow is created
2808 if dialog_state.use_shadow is true.
2809
2810 WINDOW * parent
2811 is the parent window (usually the top-level window of a widget)
2812
2813 int height
2814 is the window's height
2815
2816 int width
2817 is the window's width
2818
2819 int y
2820 is the window's top-row
2821
2822 int x
2823 is the window's left-column
2824
2825 dlg_new_window
2826 Create a window, optionally with a shadow. The shadow is created if
2827 dialog_state.use_shadow is true.
2828
2829 int height
2830 is the window's height
2831
2832 int width
2833 is the window's width
2834
2835 int y
2836 is the window's top-row
2837
2838 int x
2839 is the window's left-column
2840
2841 dlg_next_button
2842 Return the next index in the list of labels.
2843
2844 const char ** labels
2845 is a list of (pointers to) button labels terminated by a null
2846 pointer.
2847
2848 int button
2849 is the current button-index.
2850
2851 dlg_next_ok_buttonindex
2852 Assuming that the caller is using dlg_ok_labels to list buttons, find
2853 the next index in the list of buttons.
2854
2855 int current
2856 is the current index in the list of buttons
2857
2858 int extra
2859 if negative, provides a way to enumerate extra active areas on the
2860 widget.
2861
2862 dlg_ok_buttoncode
2863 Map the given button index for dlg_ok_labels into dialog's exit-code.
2864
2865 int button
2866 is the button-index (which is not necessarily the same as the in‐
2867 dex in the list of labels).
2868
2869 dlg_ok_button_key
2870 Calls dlg_button_key with the “Cancel” button disabled, e.g., for the
2871 textbox widget.
2872
2873 dlg_ok_label
2874 Returns a list with the “Ok” label, and if dialog_vars.help_button is
2875 true, the “Help” label as well.
2876
2877 dlg_ok_labels
2878 Return a list of button labels for the OK/Cancel group of widgets.
2879
2880 dlg_ordinate
2881 Decode the string as an integer, decrement if greater than zero to make
2882 a curses-ordinate from a dialog-ordinate.
2883
2884 dlg_parse_bindkey
2885 Parse the parameters of the “bindkeys” configuration-file entry. This
2886 expects widget name which may be "*", followed by curses key definition
2887 and then dialog key definition.
2888
2889 char * params
2890 is the parameter string to parse.
2891
2892 dlg_parse_rc
2893 Parse the configuration file and set up variables.
2894
2895 dlg_popen
2896 Open a pipe which ties the standard error and output together. The
2897 popen function captures only the standard output of a command.
2898
2899 const char *command
2900 The shell command to run.
2901
2902 const char *type
2903 Like popen, "r" is used to read, and "w" is used to write.
2904
2905 dlg_prev_button
2906 Return the previous index in the list of labels.
2907
2908 const char ** labels
2909 is a list of (pointers to) button labels terminated by a null
2910 pointer.
2911
2912 int button
2913 is the current button index
2914
2915 dlg_print_listitem
2916 This is a helper function used for the various “list” widgets, e.g.,
2917 checklist, menu, buildlist, treeview. Each list-widget has “tag” and
2918 “description” values for each item which can be displayed. If dia‐
2919 log_vars.no_tags is true, the “tag” value is not shown. The first
2920 character of the first value shown (tag or description) is highlighted
2921 to indicate that the widget will match it for quick navigation.
2922
2923 WINDOW *win
2924 the window in which to display the text
2925
2926 const char *text
2927 the value to display
2928
2929 int climit
2930 the number of columns available for printing the text
2931
2932 bool first
2933 true if this is the first call (for “tag” and “description”), and
2934 the first character of the value should be highlighted.
2935
2936 int selected
2937 nonzero if the text should be displayed using the “selected” col‐
2938 ors
2939
2940 dlg_print_scrolled
2941 This is a wrapper for dlg_print_autowrap which allows the user to
2942 scroll too-long prompt text up/down.
2943
2944 See dlg_check_scrolled for a function which updates the offset variable
2945 used as a parameter here. It complements this function; you need both.
2946 If pauseopt is set, this function returns an updated last parameter,
2947 needed for dlg_check_scrolled calls.
2948
2949 WINDOW * win
2950 is the window to update.
2951
2952 const char * prompt
2953 is the string to print
2954
2955 int offset
2956 is the starting line-number to write wrapped text.
2957
2958 int height
2959 is the available height for writing the wrapped text
2960
2961 int width
2962 is the width that the wrapping should occur in
2963
2964 int pauseopt
2965 is true if the extra functionality for scrolling should be en‐
2966 abled. If false, this calls dlg_print_autowrap without doing any
2967 scrolling.
2968
2969 dlg_print_line
2970 Print one line of the prompt in the window within the limits of the
2971 specified right margin. The line will end on a word boundary and a
2972 pointer to the start of the next line is returned, or a NULL pointer if
2973 the end of *prompt is reached.
2974
2975 WINDOW *win
2976 is the window to update.
2977
2978 chtype *attr
2979 holds the starting attributes, and is updated to reflect the final
2980 attributes applied to the string.
2981
2982 const char *prompt
2983 is the string to print
2984
2985 int lm
2986 is the left margin.
2987
2988 int rm
2989 is the right margin
2990
2991 int *x
2992 returns the ending x-ordinate.
2993
2994 dlg_prev_ok_buttonindex
2995 Find the previous button index in the list from dlg_ok_labels.
2996
2997 int current
2998 is the current index
2999
3000 int extra
3001 if negative provides a way to enumerate extra active areas on the
3002 widget.
3003
3004 dlg_print_autowrap
3005 Print a string of text in a window, automatically wrap around to the
3006 next line if the string is too long to fit on one line. Note that the
3007 string may contain embedded newlines. The text is written starting at
3008 the top of the window.
3009
3010 WINDOW * win
3011 is the window to update.
3012
3013 const char * prompt
3014 is the string to print
3015
3016 int height
3017 is the nominal height the wrapped string is limited to
3018
3019 int width
3020 is the width that the wrapping should occur in
3021
3022 dlg_print_size
3023 If dialog_vars.print_siz is true, print the given height/width (from a
3024 widget) to dialog_state.output, e.g., Size: height, width.
3025
3026 int height
3027 is the window's height
3028
3029 int width
3030 is the window's width
3031
3032 dlg_print_text
3033 Print up to cols columns from text, optionally rendering dialog's es‐
3034 cape sequences for attributes and color.
3035
3036 WINDOW * win
3037 is the window to update.
3038
3039 const char * txt
3040 is the string to print
3041
3042 int col
3043 is the column limit
3044
3045 chtype * attr
3046 holds the starting attributes, and is updated to reflect the final
3047 attributes applied to the string.
3048
3049 dlg_progressbox
3050 implements the "--prgbox" and "--progressbox" options.
3051
3052 const char * title
3053 is the title on the top of the widget.
3054
3055 const char * cprompt
3056 is the prompt text shown within the widget. If empty or null, no
3057 prompt is shown.
3058
3059 int height
3060 is the desired height of the box. If zero, the height is based on
3061 the screen size.
3062
3063 int width
3064 is the desired width of the box. If zero, the height is based on
3065 the screen size.
3066
3067 int pauseopt
3068 if true, an “OK” button will be shown, and the dialog will wait
3069 for it to complete. With an “OK” button, it is denoted a “pro‐
3070 grambox”, without an “OK” button, it is denoted a “progressbox”.
3071
3072 FILE * fp
3073 is the file pointer, which may be a pipe or a regular file.
3074
3075 dlg_put_backtitle
3076 Display the background title if dialog_vars.backtitle is non-null. The
3077 background title is shown at the top of the screen.
3078
3079 dlg_reallocate_gauge
3080 Allocates or reallocates a gauge widget (see dlg_allocate_gauge). Use
3081 dlg_update_gauge to display the result.
3082
3083 void ** objptr
3084 If the pointer referenced by this parameter is null, the function
3085 creates a new gauge widget using dlg_allocate_gauge. Otherwise,
3086 it updates the title and cprompt values, reusing the window from
3087 the previous call on this function. As a side-effect, the func‐
3088 tion stores the updated object-pointer via the objptr parameter.
3089
3090 const char * title
3091 is the title string to display at the top of the widget.
3092
3093 const char * cprompt
3094 is the prompt text shown within the widget.
3095
3096 int height
3097 is the desired height of the box. If zero, the height is adjusted
3098 to use the available screen size.
3099
3100 int width
3101 is the desired width of the box. If zero, the height is adjusted
3102 to use the available screen size.
3103
3104 int percent
3105 is the percentage to show in the progress bar.
3106
3107 dlg_register_buttons
3108 The widget developer should call this function after dlg_register_win‐
3109 dow, for the list of button labels associated with the widget. One may
3110 bind a key to a button, e.g., “OK” for DLGK_OK,
3111
3112 WINDOW * win
3113 is the window with which to associate the buttons
3114
3115 const char * name
3116 is the widget's binding name (usually the name of the widget).
3117
3118 const char ** buttons
3119 is the list of buttons
3120
3121 dlg_register_window
3122 For a given named widget's window, associate a binding table.
3123
3124 WINDOW * win
3125 is the window with which to associate the buttons
3126
3127 const char * name
3128 is the widget's binding name (usually the name of the widget).
3129
3130 DLG_KEYS_BINDING * binding
3131 is the binding table
3132
3133 dlg_remove_callback
3134 Remove a callback.
3135
3136 DIALOG_CALLBACK * p
3137 contains the callback information.
3138
3139 dlg_renamed_menutext
3140 This is a utility function which supports the --inputmenu option of the
3141 dialog program. If dialog_vars.input_menu is set, dialog_menu passes
3142 this pointer to dlg_menu as the rename_menutext parameter. Otherwise,
3143 it passes dlg_dummy_menutext.
3144
3145 The function should add “RENAMED” to dialog_vars.input_result , fol‐
3146 lowed by the menu item's name and the newtext value (with a space sepa‐
3147 rating the three items), and return DLG_EXIT_EXTRA.
3148
3149 DIALOG_LISTITEM * items
3150 is the list of menu items
3151
3152 int current
3153 is the index of the currently-selected item
3154
3155 char * newtext
3156 is the updated text for the menu item
3157
3158 dlg_reset_timeout
3159 Calls wtimeout with the value saved for a window in the last call to
3160 dlg_set_timeout.
3161
3162 dlg_restore_vars
3163 Restore dialog's variables from the given variable (see dia‐
3164 log_save_vars).
3165
3166 DIALOG_VARS * save
3167 is the variable from which to restore.
3168
3169 The DIALOG_VARS.input_length and DIALOG_VARS.input_result members are
3170 treated specially, since these are used by a widget to pass data to the
3171 caller. They are not modified by this function.
3172
3173 dlg_result_key
3174 Test a dialog internal keycode to see if it corresponds to one of the
3175 push buttons on the widget such as “OK”. This is only useful if there
3176 are user-defined key bindings, since there are no built-in bindings
3177 that map directly to DLGK_OK, etc. Return true if a mapping was done.
3178
3179 int dialog_key
3180 is the dialog key to test
3181
3182 int fkey
3183 is true if this is a function key
3184
3185 int * resultp
3186 store the result of the mapping in the referenced location.
3187
3188 dlg_save_vars
3189 Save dialog's variables into the given variable (see dlg_restore_vars).
3190
3191 DIALOG_VARS * save
3192 is the variable into which to save.
3193
3194 dlg_set_focus
3195 Set focus on the given window, making it display above other windows on
3196 the screen.
3197
3198 WINDOW * parent
3199 is the parent window (usually the top-level window of a widget)
3200
3201 WINDOW * win
3202 is the window on which to place focus (usually a subwindow of a
3203 widget)
3204
3205 dlg_set_result
3206 Setup a fixed-buffer for the result in dialog_vars.input_result
3207
3208 const char * string
3209 is the new contents for the result
3210
3211 dlg_set_timeout
3212 Calls wtimeout to establish a preferred timeout for nonblocking reads,
3213 e.g., to allow the gauge widget to handle window-resizing events. The
3214 dlg_may_resize function temporarily overrides this value, to allow it
3215 to skip over the error codes returned while the ncurses library pro‐
3216 cesses window-resizing events. It restores the value established in
3217 this call by calling dlg_restore_timeout.
3218
3219 WINDOW * win
3220 is the window whose input-timeout should be set
3221
3222 bool will_getc
3223 is true if the widget is expected to read keyboard characters.
3224 Some (such as the gauge widget) do not.
3225
3226 dlg_show_string
3227 Displays the string, shifted as necessary, to fit within the box and
3228 show the current character-offset.
3229
3230 WINDOW * win
3231 is the window within which to display
3232
3233 const char * string
3234 is the string to display
3235
3236 int offset
3237 is the starting (character, not bytes) offset
3238
3239 chtype attr
3240 is the window attribute to use for the string
3241
3242 int y_base
3243 beginning row on screen
3244
3245 int x_base
3246 beginning column on screen
3247
3248 int x_last
3249 number of columns on screen
3250
3251 bool hidden
3252 if true, do not echo input
3253
3254 bool force
3255 if true, force repaint
3256
3257 dlg_strclone
3258 duplicate the string, like strdup.
3259
3260 const char * cprompt
3261 is the string to duplicate
3262
3263 dlg_strcmp
3264 compare two strings, ignoring case.
3265
3266 const char * a
3267 is one string
3268
3269 const char * b
3270 is the other string
3271
3272 dlg_string_to_argv
3273 Convert a string to an argument vector returning an index (which must
3274 be freed by the caller). The string is modified:
3275
3276 • Blanks between arguments are replaced by nulls.
3277
3278 • Normally arguments are separated by blanks; however you can double-
3279 quote an argument to enclose blanks. The surrounding double-quotes
3280 are removed from the string.
3281
3282 • A backslash preceding a double-quote within double-quotes is re‐
3283 moved.
3284
3285 • A backslash preceding a newline outside double-quotes is removed.
3286
3287 • Except for special cases, backslashes are preserved in the strings,
3288 since other dialog functions interpret backslashes, e.g., for col‐
3289 ors.
3290
3291 char *blob
3292 is the string to convert.
3293
3294 dlg_sub_window
3295 create a subwindow, e.g., for an input area of a widget
3296
3297 WINDOW * win
3298 is the parent window
3299
3300 int height
3301 is the subwindow's height
3302
3303 int width
3304 is the subwindow's width
3305
3306 int y
3307 is the subwindow's top-row
3308
3309 int x
3310 is the subwindow's left-column
3311
3312 dlg_tab_correct_str
3313 If the dialog_vars.tab_correct is true, convert tabs to single spaces.
3314 Return the converted result. The caller is responsible for freeing the
3315 string.
3316
3317 char * prompt
3318 is the string to convert
3319
3320 dlg_trace
3321 If the parameter is non-null, opens a trace file with that name and
3322 stores the file pointer in dialog_state.trace.
3323
3324 dlg_trace_2n
3325 logs a numeric value as a comment.
3326
3327 char * name
3328 is the name to log in the comment.
3329
3330 int value
3331 is the value to log in the comment.
3332
3333 dlg_trace_2s
3334 logs a string value as a comment. If the value contains embedded new‐
3335 lines, the comment is continued with “#+” markers.
3336
3337 char * name
3338 is the name to log in the comment.
3339
3340 int value
3341 is the value to log in the comment.
3342
3343 dlg_trace_chr
3344 If dialog_state.trace is set, translate the parameters into a printable
3345 representation, log it on a “chr” line.
3346
3347 int ch
3348 is the nominal keycode value.
3349
3350 int fkey
3351 is nonzero if the value is really a function key. Some of these
3352 may be values declared in the DLG_KEYS_ENUM.
3353
3354 dlg_trace_msg
3355 Write a formatted message to the trace file.
3356
3357 const char * fmt
3358 is the format of the printf-like message to write.
3359
3360 ...
3361 are the variables to apply to the fmt format.
3362
3363 Use the DLG_TRACE macro for portability, in case the trace feature is
3364 not compiled into the library. It uses an extra level of parentheses
3365 to work with a variable number of parameters, e.g.,
3366
3367 DLG_TRACE(("this is dialog version %s\n", dialog_version()));
3368
3369 dlg_trace_va_msg
3370 Write a formatted message to the trace file.
3371
3372 const char *fmt
3373 is the format of the printf-like message to write.
3374
3375 va_list ap
3376 are the variables to apply to the fmt format.
3377
3378 This is used in dlg_exiterr to capture error messages in the trace
3379 file:
3380
3381 va_start(ap, fmt);
3382 dlg_trace_msg("## Error: ");
3383 dlg_trace_va_msg(fmt, ap);
3384 va_end(ap);
3385
3386 Unlike dlg_trace_msg, an extra macro is not needed.
3387
3388 dlg_ttysize
3389 Returns the screensize without using curses. That allows the function
3390 to be used before initializing the screen.
3391
3392 dlg_trace_win
3393 If dialog_state.trace is set, log a printable picture of the given win‐
3394 dow.
3395
3396 dlg_treeview
3397 This is an alternate interface to 'treeview' which allows the applica‐
3398 tion to read the list item states back directly without putting them in
3399 the output buffer.
3400
3401 const char * title
3402 is the title on the top of the widget.
3403
3404 const char * cprompt
3405 is the prompt text shown within the widget.
3406
3407 int height
3408 is the desired height of the box. If zero, the height is based on
3409 the screen size.
3410
3411 int width
3412 is the desired width of the box. If zero, the height is based on
3413 the screen size.
3414
3415 int list_height
3416 is the minimum height to reserve for displaying the list. If
3417 zero, it is computed based on the given height and width.
3418
3419 int item_no
3420 is the number of rows in items.
3421
3422 DIALOG_LISTITEM * items
3423 is the list of items, contain tag, name, and optionally help
3424 strings (if dialog_vars.item_help is set). The initial selection
3425 state for each item is also in this list.
3426
3427 const char * states
3428 This is a list of characters to display for the given states.
3429 Normally a buildlist provides true (1) and false (0) values, which
3430 the widget displays as "*" and space, respectively. An applica‐
3431 tion may set this parameter to an arbitrary null-terminated
3432 string. The widget determines the number of states from the
3433 length of this string, and will cycle through the corresponding
3434 display characters as the user presses the space-bar.
3435
3436 int * depths
3437 This is a list of depths of each item in the tree. It is a sepa‐
3438 rate parameter from items to allow reuse of the existing func‐
3439 tions.
3440
3441 int flag
3442 is either FLAG_CHECK, for checklists (multiple selections), or
3443 FLAG_RADIO for radiolists (a single selection).
3444
3445 int * current_item
3446 The widget sets the referenced location to the index of the cur‐
3447 rent display item (cursor) when it returns.
3448
3449 dlg_trim_string
3450 The dialog program uses this in each widget to adjust the message
3451 string, which may contain the newline character (referred to as '\n')
3452 and/or the special substring "\n" (which can be translated into a new‐
3453 line character).
3454
3455 There are several optional features:
3456
3457 • Unless dialog_vars.nocollapse is set, each tab is converted to a
3458 space before other processing.
3459
3460 • If dialog_vars.no_nl_expand is not set, and the string has "\n"
3461 substrings:
3462
3463 • The function changes embedded "\n" substrings to '\n' charac‐
3464 ters.
3465
3466 The function preserves extra spaces after these substitutions.
3467 For instance, spaces following a newline (substring or charac‐
3468 ter) are preserved to use as an indentation.
3469
3470 • If dialog_vars.cr_wrap is set, the function preserves '\n' new‐
3471 line characters. Otherwise, each '\n' newline character is
3472 converted to a space.
3473
3474 • Otherwise, if dialog_vars.trim_whitespace is set:
3475
3476 • This function strips all extra spaces to simplify justifica‐
3477 tion.
3478
3479 • If dialog_vars.cr_wrap is set, the function preserves '\n' new‐
3480 line characters. Otherwise, each '\n' newline character is
3481 converted to a space.
3482
3483 • Finally (if dialog_vars.no_nl_expand is set, or the string does not
3484 contain "\n" substrings, and dialog_vars.trim_whitespace is not
3485 set):
3486
3487 • Unless dialog_vars.nocollapse is set, sequences of spaces are
3488 reduced to a single space.
3489
3490 char * src
3491 is the string to trim
3492
3493 dlg_unregister_window
3494 Remove the bindings for a given window.
3495
3496 WINDOW * win
3497 is the window from which to remove bindings
3498
3499 dlg_update_gauge
3500 Update a gauge widget to show a different percentage value.
3501
3502 void *objptr
3503 points to the gauge object to update.
3504
3505 int percent
3506 is the new percentage value to display.
3507
3508 dlg_will_resize
3509 This filters out bursts of KEY_RESIZE values. Call this after dlg_getc
3510 returns KEY_RESIZE, to improve performance.
3511
3512 dlg_yes_buttoncode
3513 Map the given button index for dlg_yes_labels into dialog's exit-code.
3514
3515 int button
3516 is the button index
3517
3518 dlg_yes_labels
3519 Return a list of buttons for Yes/No labels.
3520
3521 end_dialog
3522 End use of dialog functions.
3523
3524 init_dialog
3525 Do some initialization for dialog.
3526
3527 FILE *input
3528 is the real tty input of dialog. Usually it is the standard in‐
3529 put, but if --input-fd option is used, it may be anything.
3530
3531 FILE *output
3532 is where dialog will send its result. Usually it is the standard
3533 error, but if --stdout or --output-fd is used, it may be anything.
3534
3536 dialog (1).
3537
3539 Thomas E. Dickey
3540
3541
3542
3543$Date: 2021/12/13 22:40:26 $ DIALOG(3)