Scroll to navigation

DIALOG(3) Library Functions Manual DIALOG(3)

NAME

dialog - widgets and utilities for the dialog program

SYNOPSIS

cc [ flag ... ] file ... -ldialog [ library ... ]

#include <dialog.h>

Dialog is a program that will let you to present a variety of questions or display messages using dialog boxes from a shell script. It is built from the dialog library, which consists of several widgets as well as utility functions that are used by the widgets or the main program.

DESCRIPTION

This manpage documents the features from <dialog.h> which are likely to be important to developers using the widgets directly. Some hints are also given for developing new widgets.

DEFINITIONS

Exit codes (passed back to the main program for its use) are defined with a "DLG_EXIT_ prefix. The defined constants can be mapped using environment variables as described in dialog(1), e.g., DLG_EXIT_OK corresponds to $DIALOG_OK.

Useful character constants which correspond to user input are named with the "CHR_" prefix, e.g., CHR_BACKSPACE.

Colors and video attributes are categorized and associated with settings in the configuration file (see the discussion of $DIALOGRC in dialog(1)). The DIALOG_ATR(n) macro is used for defining the references to the combined color and attribute table dlg_color_table[].

The dialog application passes its command-line parameters to the widget functions. Some of those parameters are single values, but some of the widgets accept data as an array of values. Those include checklist/radiobox, menubox and formbox. When the --item-help option is given, an extra column of data is expected. The USE_ITEM_HELP(), CHECKBOX_TAGS, MENUBOX_TAGS and FORMBOX_TAGS macros are used to hide this difference from the calling application.

Most of the other definitions found in <dialog.h> are used for convenience in building the library or main program. These include definitions based on the generated <dlg_config.h> header.

DATA STRUCTURES

All of the global data for the dialog library is stored in a few structures: DIALOG_STATE, DIALOG_VARS and DIALOG_COLORS. The corresponding dialog_state, dialog_vars and dlg_color_table global variables should be initialized to zeros, and then populated with the data to use. A few of these must be nonzero for the corresponding widgets to function. As as the case with function names, variables beginning with "dialog_" are designed for use by the calling application while variables beginning with "dlg_" are intended for lower levels, e.g., by the dialog library.

This is a linked list of all windows created by the library. The dlg_del_window function uses this to locate windows which may be redrawn after deleting a window.
This corresponds to the command-line option "--aspect-ratio". The value gives the application some control over the box dimensions when using auto sizing (specifying 0 for height and width). It represents width / height. The default is 9, which means 9 characters wide to every 1 line high.
This is setup in ui_getc.c to record windows which must be polled for input, e.g,. to handle the background tailbox widget. One window is designated as the foreground or control window.
If the control window for DIALOG_STATE.getc_callbacks is closed, the list is transferred to this variable. Closing all windows causes the application to exit.
This is set in the dialog application to the stream on which the application and library functions may write text results. Normally that is the standard error, since the curses library prefers to write its data to the standard output. Some scripts, trading portability for convenience, prefer to write results to the standard output, e.g., by using the "--stdout" option.
This is incremented by dlg_does_output, which is called by each widget that writes text to the output. The dialog application uses that to decide if it should also write a separator, i.e., DIALOG_STATE.separate_str, between calls to each widget.
This is set in init_dialog to a stream which can be used by the gauge widget, which must be the application's standard input. The dialog application calls init_dialog normally with input set to the standard input, but optionally based on the "--input-fd" option. Since the application cannot read from a pipe (standard input) and at the same time read the curses input from the standard input, it must allow for reopening the latter from either a specific file descriptor, or directly from the terminal. The adjusted pipe stream value is stored in this variable.
This is set in init_dialog and reset in end_dialog. It is used to check if curses has been initialized, and if the endwin function must be called on exit.
This is set in init_dialog to the output stream used by the curses library. Normally that is the standard output, unless that happens to not be a terminal (and if init_dialog can successfully open the terminal directly).
This corresponds to the command-line option "--separate-widget". The given string specifies a string that will separate the output on dialog's output from each widget. This is used to simplify parsing the result of a dialog with several widgets. If this option is not given, the default separator string is a tab character.
This corresponds to the command-line option "--tab-len number". Specify the number of spaces that a tab character occupies if the "--tab-correct" option is given. The default is 8.
This is set in init_dialog if the curses implementation supports color.
This corresponds to the command-line option "--no-shadow". This is set in init_dialog if the curses implementation supports color. If true, suppress shadows that would be drawn to the right and bottom of each dialog box.
This corresponds to the command-line option "--visit-items".

The dialog application resets the dialog_vars data before accepting options to invoke each widget. Most of the DIALOG_VARS members are set directly from dialog's command-line options:

This corresponds to the command-line option "--backtitle backtitle". It specifies a backtitle string to be displayed on the backdrop, at the top of the screen.
This corresponds to the command-line option "--beep-after". If true, beep after a user has completed a widget by pressing one of the buttons.
This corresponds to the command-line option "--beep". It is obsolete.
This is true if the command-line option "--begin y x" was used. It specifies the position of the upper left corner of a dialog box on the screen.
This corresponds to the x value from the command-line option "--begin y x" (second value).
This corresponds to the y value from the command-line option "--begin y x" (first value).
This corresponds to the command-line option "--cancel-label string". The given string overrides the label used for "Cancel" buttons.
This corresponds to the command-line option "--no-kill". If true, this tells dialog to put the tailboxbg box in the background, printing its process id to dialog's output. SIGHUP is disabled for the background process.
This corresponds to the command-line option "--colors". If true, interpret embedded "\Z" sequences in the dialog text by the following character, which tells dialog to set colors or video attributes: 0 through 7 are the ANSI codes used in curses: black, red, green, yellow, blue, magenta, cyan and white respectively. Bold is set by 'b', reset by 'B'. Reverse is set by 'r', reset by 'R'. Underline is set by 'u', reset by 'U'. The settings are cumulative, e.g., "\Zb\Z1" makes the following text bright red. Restore normal settings with "\Zn".
This corresponds to the command-line option "--cr-wrap". If true, interpret embedded newlines in the dialog text as a newline on the screen. Otherwise, dialog will only wrap lines where needed to fit inside the text box. Even though you can control line breaks with this, dialog will still wrap any lines that are too long for the width of the box. Without cr-wrap, the layout of your text may be formatted to look nice in the source code of your script without affecting the way it will look in the dialog.
This corresponds to the command-line option "--default-item string". The given string is used as the default item in a checklist, form or menu box. Normally the first item in the box is the default.
This corresponds to the command-line option "--defaultno". If true, make the default value of the yes/no box a No. Likewise, make the default button of widgets that provide "OK" and "Cancel" a Cancel. If --nocancel was given that option overrides this, making the default button always "Yes" (internally the same as "OK").
This corresponds to the command-line option "--clear". This option is implemented in the main program, not the library. If true, the screen will be cleared on exit. This may be used alone, without other options.
This corresponds to the command-line option "--exit-label string". The given string overrides the label used for "EXIT" buttons.
This corresponds to the command-line option "--extra-button". If true, some widgets show an extra button, between "OK" and "Cancel" buttons.
This corresponds to the command-line option "--extra-label string". The given string overrides the label used for "Extra" buttons. Note: for inputmenu widgets, this defaults to "Rename".
This is set by the command-line option "--passwordform" to tell the form widget that its text fields should be treated like password widgets.
This corresponds to the command-line option "--help-button". If true, some widgets show a help-button after "OK" and "Cancel" buttons, i.e., in checklist, radiolist and menu boxes. If --item-help is also given, on exit the return status will be the same as for the "OK" button, and the item-help text will be written to dialog's output after the token "HELP". Otherwise, the return status will indicate that the Help button was pressed, and no message printed.
This corresponds to the command-line option "--help-label string". The given string overrides the label used for "Help" buttons.
This corresponds to the command-line option "--help-status". If true, and the the help-button is selected, writes the checklist or radiolist information after the item-help "HELP" information. This can be used to reconstruct the state of a checklist after processing the help request.
This is nonzero if DIALOG_VARS.input_result is allocated, versus being a pointer to the user's local variables.
This flag is set to denote whether the menubox widget implements a menu versus a inputmenu widget.
If DIALOG_VARS.input_length is zero, this is a pointer to user buffer (on the stack, or static). When DIALOG_VARS.input_length is nonzero, this is a dynamically-allocated buffer used by the widgets to return printable results to the calling application.
This corresponds to the command-line option "--insecure". If true, make the password widget friendlier but less secure, by echoing asterisks for each character.
This corresponds to the command-line option "--item-help". If true, interpret the tags data for checklist, radiolist and menu boxes adding a column whose text is displayed in the bottom line of the screen, for the currently selected item.
This is set by the command-line option "--keep-tite" to tell dialog to not attempt to cancel the terminal initialization (termcap ti/te) sequences which correspond to xterm's alternate-screen switching. Normally dialog does this to avoid flickering when run several times in a script.
This corresponds to the command-line option "--keep-window". If true, do not remove/repaint the window on exit. This is useful for keeping the window contents visible when several widgets are run in the same process. Note that curses will clear the screen when starting a new process.
This corresponds to the command-line option "--max-input size". Limit input strings to the given size. If not specified, the limit is 2048.
This corresponds to the command-line option "--no-label string". The given string overrides the label used for "No" buttons.
This corresponds to the command-line option "--no-cancel". If true, suppress the "Cancel" button in checklist, inputbox and menu box modes. A script can still test if the user pressed the ESC key to cancel to quit.
This corresponds to the command-line option "--no-collapse". Normally dialog converts tabs to spaces and reduces multiple spaces to a single space for text which is displayed in a message boxes, etc. It true, that feature is disabled. Note that dialog will still wrap text, subject to the --cr-wrap option.
This corresponds to the command-line option "--ok-label string". The given string overrides the label used for "OK" buttons.
This corresponds to the command-line option "--print-size". If true, each widget prints its size to dialog's output when it is invoked.
This corresponds to the command-line option "--separate-output". If true, checklist widgets output result one line at a time, with no quoting. This facilitates parsing by another program.
This corresponds to the command-line option "--single-quoted". If true, Use single-quoting as needed (and no quotes if unneeded) for the output of checklist's as well as the item-help text. If this option is not set, dialog uses double quotes around each item. That requires occasional use of backslashes to make the output useful in shell scripts.
This corresponds to the command-line option "--size-err". If true, check the resulting size of a dialog box before trying to use it, printing the resulting size if it is larger than the screen. (This option is obsolete, since all new-window calls are checked).
This corresponds to the command-line option "--sleep secs". This option is implemented in the main program, not the library. If nonzero, this is the number of seconds after to delay after processing a dialog box.
This corresponds to the command-line option "--tab-correct". If true, convert each tab character of the text to one or more spaces. Otherwise, tabs are rendered according to the curses library's interpretation.
This corresponds to the command-line option "--timeout secs". If nonzero, timeout input requests (exit with error code) if no user response within the given number of seconds.
This corresponds to the command-line option "--title title". Specifies a title string to be displayed at the top of the dialog box.
This corresponds to the command-line option "--trim". If true, eliminate leading blanks, trim literal newlines and repeated blanks from message text.
This corresponds to the command-line option "--visit-items". Modify the tab-traversal of checklist, radiobox, menubox and inputmenu to include the list of items as one of the states. This is useful as a visual aid, i.e., the cursor position helps some users.
This corresponds to the command-line option "--yes-label string". The given string overrides the label used for "Yes" buttons.

WIDGETS

Functions that implement major functionality for the command-line dialog program, e.g., widgets, have names beginning "dialog_".

All dialog boxes have at least three parameters:

title
the caption for the box, shown on its top border.
height
the height of the dialog box.
width
the width of the dialog box.

Other parameters depend on the box type.

implements the "--calendar" option.
is the title on the top of the widget.
is the prompt text shown within the widget.
is the height excluding the fixed-height calendar grid.
is the overall width of the box, which is adjusted up to the calendar grid's minimum width if needed.
is the initial day of the week shown, counting zero as Sunday. If the value is negative, the current day of the week is used.
is the initial month of the year shown, counting one as January. If the value is negative, the current month of the year is used.
is the initial year shown. If the value is negative, the current year is used.
implements the "--checklist" and "--radiolist" options depending on the flag parameter.
is the title on the top of the widget.
is the prompt text shown within the widget.
is the desired height of the box. If zero, the height is adjusted to use the available screen size.
is the desired width of the box. If zero, the height is adjusted to use the available screen size.
is the minimum height to reserve for displaying the list. If zero, it is computed based on the given height and width.
is the number of rows in items.
is an array of strings which is viewed either as a list of rows
tag item status
or
tag item status help
depending on whether dialog_vars.item_help is set.
is either FLAG_CHECK, for checklists, or FLAG_RADIO for radiolists.
implements the "--dselect" option.
is the title on the top of the widget.
is the preselected value to show in the input-box, which is used also to set the directory- and file-windows.
is the height excluding the minimum needed to show the dialog box framework. If zero, the height is based on the screen size.
is the desired width of the box. If zero, the height is based on the screen size.
implements the "--editbox" option.
is the title on the top of the widget.
is the name of the file from which to read.
is the desired height of the box. If zero, the height is adjusted to use the available screen size.
is the desired width of the box. If zero, the height is adjusted to use the available screen size.
implements the "--form" option.
is the title on the top of the widget.
is the prompt text shown within the widget.
is the desired height of the box. If zero, the height is adjusted to use the available screen size.
is the desired width of the box. If zero, the height is adjusted to use the available screen size.
is the minimum height to reserve for displaying the list. If zero, it is computed based on the given height and width.
is the number of rows in items.
is an array of strings which is viewed either as a list of rows
Name NameY NameX Text TextY TextX FLen ILen
or
Name NameY NameX Text TextY TextX FLen ILen Help
depending on whether dialog_vars.item_help is set.
implements the "--fselect" option.
is the title on the top of the widget.
is the preselected value to show in the input-box, which is used also to set the directory- and file-windows.
is the height excluding the minimum needed to show the dialog box framework. If zero, the height is based on the screen size.
is the desired width of the box. If zero, the height is based on the screen size.
implements the "--gauge" option.
is the title on the top of the widget.
is the prompt text shown within the widget.
is the desired height of the box. If zero, the height is based on the screen size.
is the desired width of the box. If zero, the height is based on the screen size.
is the percentage to show in the progress bar.
implements the "--inputbox" or "--password" option, depending on the value of password.
is the title on the top of the widget.
is the prompt text shown within the widget.
is the desired height of the box. If zero, the height is based on the screen size.
is the desired width of the box. If zero, the height is based on the screen size.
is the initial value of the input box, whose length is taken into account when auto-sizing the width of the dialog box.
if true, causes typed input to be echoed as asterisks.
implements the "--menu" or "--inputmenu" option depending on whether dialog_vars.input_menu is set.
is the title on the top of the widget.
is the prompt text shown within the widget.
is the desired height of the box. If zero, the height is based on the screen size.
is the desired width of the box. If zero, the height is based on the screen size.
is the minimum height to reserve for displaying the list. If zero, it is computed based on the given height and width.
is the number of rows in items.
is an array of strings which is viewed either as a list of rows
tag item
or
tag item help
depending on whether dialog_vars.item_help is set.
implements the "--mixedform" option.
is the title on the top of the widget.
is the prompt text shown within the widget.
is the desired height of the box. If zero, the height is adjusted to use the available screen size.
is the desired width of the box. If zero, the height is adjusted to use the available screen size.
is the minimum height to reserve for displaying the list. If zero, it is computed based on the given height and width.
is the number of rows in items.
is an array of strings which is viewed either as a list of rows
Name NameY NameX Text TextY TextX FLen ILen Ityp
or
Name NameY NameX Text TextY TextX FLen ILen Ityp Help
depending on whether dialog_vars.item_help is set.
implements the "--mixedgauge" option
is the title on the top of the widget.
is the caption text shown within the widget.
is the desired height of the box. If zero, the height is based on the screen size.
is the desired width of the box. If zero, the height is based on the screen size.
is the percentage to show in the progress bar.
is the number of rows in items.
is an array of strings which is viewed as a list of tag and item values. The tag values are listed, one per row, in the list at the top of the widget.
The item values are decoded: digits 0-9 are the following strings
0
Succeeded
1
Failed
2
Passed
3
Completed
4
Checked
5
Done
6
Skipped
7
In Progress
8
(blank)
9
N/A
A string with a leading "-" character is centered, marked with "%". For example, "-75" is displayed as "75%". Other strings are displayed as is.
implements the "--msgbox" or "--infobox" option depending on whether pauseopt is set.
is the title on the top of the widget.
is the prompt text shown within the widget.
is the desired height of the box. If zero, the height is based on the screen size.
is the desired width of the box. If zero, the height is based on the screen size.
if true, an "OK" button will be shown, and the dialog will wait for it to complete. With an "OK" button, it is denoted a "msgbox", without an "OK" button, it is denoted an "infobox".
implements the "--pause" option.
is the title on the top of the widget.
is the desired height of the box. If zero, the height is based on the screen size.
is the desired width of the box. If zero, the height is based on the screen size.
is the timeout to use for the progress bar.
implements the "--progressbox" option.
is the title on the top of the widget.
is the prompt text shown within the widget. If empty or null, no prompt is shown.
is the desired height of the box. If zero, the height is based on the screen size.
is the desired width of the box. If zero, the height is based on the screen size.
implements the "--tailbox" or "--tailboxbg" option depending on whether bg_task is set.
is the title on the top of the widget.
is the name of the file to display in the dialog.
is the desired height of the box. If zero, the height is based on the screen size.
is the desired width of the box. If zero, the height is based on the screen size.
if true, the window is added to the callback list in dialog_state, and the application will poll for the window to be updated. Otherwise an "OK" button is added to the window, and it will be closed when the button is activated.
implements the "--textbox" option.
is the title on the top of the widget.
is the name of the file to display in the dialog.
is the desired height of the box. If zero, the height is based on the screen size.
is the desired width of the box. If zero, the height is based on the screen size.
implements the "--timebox" option.
is the title on the top of the widget.
is the prompt text shown within the widget.
is the desired height of the box. If zero, the height is based on the screen size.
is the desired width of the box. If zero, the height is based on the screen size.
is the initial hour shown. If the value is negative, the current hour is used.
is the initial minute shown. If the value is negative, the current minute is used.
is the initial second shown. If the value is negative, the current second is used.
implements the "--yesno" option.
is the title on the top of the widget.
is the prompt text shown within the widget.
is the desired height of the box. If zero, the height is based on the screen size.
is the desired width of the box. If zero, the height is based on the screen size.

UTILITY FUNCTIONS

Most functions that implement lower-level functionality for the command-line dialog program or widgets, have names beginning "dlg_". Bowing to longstanding usage, the functions that initialize the display and end it are named init_dialog and end_dialog.

The only non-widget function whose name begins with "dialog_" is dialog_version, which returns the version number of the library as a string.

Here is a brief summary of the utility functions and their parameters:

Add a callback, used to allow polling input from multiple tailbox widgets.
contains the callback information.
Add a quoted string to the result buffer (see dlg_add_result).
is the string to add.
Add a quoted string to the result buffer dialog_vars.input_result.
is the string to add.
Add an output-separator to the result buffer dialog_vars.input_result. If dialog_vars.output_separator is set, use that. Otherwise, if dialog_vars.separate_output is set, use newline. If neither is set, use a space.
Add a quoted or unquoted string to the result buffer (see dlg_add_quoted) and dlg_add_result), according to whether dialog_vars.quoted is true.
is the string to add.
Copy and reformat an array of pointers to strings, aligning according to the column separator dialog_vars.column_separator. If no column separator is set, the array will be unmodified; otherwise it is copied and reformatted.
Caveat: This function is only implemented for 8-bit characters.
This is the array to reformat. It points to the first string to modify.
This is the size of the struct for each row of the array.
This is the number of rows in the array.
returns its parameter transformed to the corresponding "+" or "-", etc. for the line-drawing characters used in dialog. If the parameter is not a line-drawing or other special character such as ACS_DARROW, it returns 0.

Set window to the given attribute.
is the window to update.
is the number of rows to update.
is the number of columns to update.
is the attribute, e.g., A_BOLD.
Automatically size the window used for a widget. If the given height or width are zero, justify the prompt text and return the actual limits.
is the title string to display at the top of the widget.
is the message text which will be displayed in the widget, used here to determine how large the widget should be.
is the nominal height.
is the nominal width.
is the number of lines to reserve in the vertical direction.
is the minimum number of columns to use.
Like dlg_auto_size, but use a file contents to decide how large the widget should be.
is the title string to display at the top of the widget.
is the name of the file.
is the nominal height. If it is -1, use the screen's height after subtracting dialog_vars.begin_y if dialog_vars.begin_set is true.
is the nominal width. If it is -1, use the screen's width after subtracting dialog_vars.begin_x if dialog_vars.begin_set is true.
is the number of lines to reserve on the screen for drawing boxes.
is the number of columns to reserve on the screen for drawing boxes.
If dialog_vars.beep_signal is nonzero, this calls beep once and sets dialog_vars.beep_signal to zero.
returns its parameter transformed as follows:
-
if neither dialog_vars.ascii_lines nor dialog_vars.no_lines is set.
-
if dialog_vars.ascii_lines is set, returns the corresponding "+" or "-", etc. for the line-drawing characters used in dialog.
-
otherwise, if dialog_vars.no_lines is set, returns a space for the line-drawing characters.
-
if the parameter is not a line-drawing or other special character such as ACS_DARROW, it returns the parameter unchanged.
returns a suitable x-ordinate (column) for a new widget. If dialog_vars.begin_set is 1, use dialog_vars.begin_x; otherwise center the widget on the screen (using the width parameter).
is the width of the widget.
returns a suitable y-ordinate (row) for a new widget. If dialog_vars.begin_set is 1, use dialog_vars.begin_y; otherwise center the widget on the screen (using the height parameter).
is the height of the widget.
Count the buttons in the list.
is a list of (pointers to) button labels terminated by a null pointer.
Make sure there is enough space for the buttons by computing the width required for their labels, adding margins and limiting based on the screen size.
is a list of (pointers to) button labels terminated by a null pointer.
the function sets the referenced limit to the width required for the widest label (limited by the screen size) if that is wider than the passed-in limit.
Compute the size of the button array in columns.
is a list of (pointers to) button labels terminated by a null pointer.
is true if the buttons are arranged in a column rather than a row.
Return the total number of columns in the referenced location.
Return the longest button's columns in the referenced location.
Compute the step-size needed between elements of the button array.
is a list of (pointers to) button labels terminated by a null pointer.
is the maximum number of columns to allow for the buttons.
store the nominal gap between buttons in the referenced location. This is constrained to be at least one.
store the left+right total margins (for the list of buttons) in the referenced location.
store the step-size in the referenced location.
Find the first uppercase character in the label, which we may use for an abbreviation. If the label is empty, return -1. If no uppercase character is found, return 0. Otherwise return the uppercase character.
is the label to test.
Calculate the minimum width for the list, assuming none of the items are truncated.
is the number of items.
contains a name and text field, e.g., for checklists or radiobox lists. The function returns the sum of the widest columns needed for of each of these fields.
Calculate new height and list_height values.
on input, is the height without adding the list-height. On return, this contains the total list-height and is the actual widget's height.
on input, is the requested list-height. On return, this contains the number of rows available for displaying the list after taking into account the screen size and the dialog_vars.begin_set and dialog_vars.begin_y variables.
is the number of items in the list.
This function is obsolete, provided for library-compatibility. It is replaced by dlg_calc_list_width.
is the number of items.
is a list of character pointers.
is the number of items in each group, e.g., the second array index.
Given a list of button labels, and a character which may be the abbreviation for one, find it, if it exists. An abbreviation will be the first character which happens to be capitalized in the label. If the character is found, return its index within the list of labels. Otherwise, return DLG_EXIT_UNKNOWN.
is the character to find.
is a list of (pointers to) button labels terminated by a null pointer.
This entrypoint provides the --checklist or --radiolist functionality without the limitations of dialog's command-line syntax (compare to dialog_checklist).
is the title string to display at the top of the widget.
is the prompt text shown within the widget.
is the desired height of the box. If zero, the height is adjusted to use the available screen size.
is the desired width of the box. If zero, the height is adjusted to use the available screen size.
is the minimum height to reserve for displaying the list. If zero, it is computed based on the given height and width.
is the number of items.
This is a list of the items to display in the checklist.
This is a list of characters to display for the given states. Normally a checklist provides true (1) and false (0) values, which the widget displays as "*" and space, respectively. An application may set this parameter to an arbitrary null-terminated string. The widget determines the number of states from the length of this string, and will cycle through the corresponding display characters as the user presses the space-bar.
This is should be one of FLAG_CHECK or FLAG_RADIO, depending on whether the widget should act as a checklist or radiobox.
The widget sets the referenced location to the index of the current display item (cursor) when it returns.
Set window to the default dialog screen attribute. This is set in the rc-file with screen_color.
Free storage used for the result buffer (dialog_vars.input_result).
Return the number of colors that can be configured in dialog.
Initialize the color pairs used in dialog.
Returns the number of columns used for a string. This is not necessarily the number of bytes in a string.
is the string to measure.
Returns the number of wide-characters in the string.
is the string to measure.
Create a configuration file, i.e., write internal tables to a file which can be read back by dialog as an rc-file.
is the name of the file to write to.
If dialog_vars.size_err is true, check if the given window size is too large to fit on the screen. If so, exit with an error reporting the size of the window.
is the window's height
is the window's width
If dialog_vars.default_item is not null, find that name by matching the name field in the list of form items. If found, return the index of that item in the list. Otherwise, return zero.
is the list of items to search. It is terminated by an entry with a null name field.
This function is obsolete, provided for library-compatibility. It is replaced by dlg_default_formitem and dlg_default_listitem.
is the list of items to search.
is the number of items in each group, e.g., the second array index.
If dialog_vars.defaultno is true, and dialog_vars.nocancel is not, find the button-index for the "Cancel" button. Otherwise, return the index for "OK" (always zero).
Remove a window, repainting everything else.
is the window to remove.
This is called each time a widget is invoked which may do output. It increments dialog_state.output_count, so the output function in dialog can test this and add a separator.
Draw up/down arrows on a window, e.g., for scrollable lists. It calls dlg_draw_arrows2 using the menubox_color and menubox_border_color attributes.
is the window on which to draw an arrow.
is true if an up-arrow should be drawn at the top of the window.
is true if an down-arrow should be drawn at the bottom of the window.
is the zero-based column within the window on which to draw arrows.
is the zero-based row within the window on which to draw up-arrows as well as a horizontal line to show the window's top.
is the zero-based row within the window on which to draw down-arrows as well as a horizontal line to show the window's bottom.
Draw up/down arrows on a window, e.g., for scrollable lists.
is the window on which to draw an arrow.
is true if an up-arrow should be drawn at the top of the window.
is true if an down-arrow should be drawn at the bottom of the window.
is the zero-based column within the window on which to draw arrows.
is the zero-based row within the window on which to draw up-arrows as well as a horizontal line to show the window's top.
is the zero-based row within the window on which to draw down-arrows as well as a horizontal line to show the window's bottom.
is the window's background attribute.
is the window's border attribute.
Draw a partial box at the bottom of a window, e.g., to surround a row of buttons. It is designed to merge with an existing box around the whole window, so it uses tee-elements rather than corner-elements on the top corners of this box.
is the window to update.
Draw a rectangular box with line drawing characters.
is the window to update.
is the top row of the box.
is the left column of the box.
is the height of the box.
is the width of the box.
is used to color the right/lower edges. It also is fill-color used for the box contents.
is used to color the upper/left edges.
Print a list of buttons at the given position.
is the window to update.
is the starting row.
is the starting column.
is a list of (pointers to) button labels terminated by a null pointer.
is the index within the list of the selected button.
is true if the buttons are arranged in a column rather than a row.
is the number of columns (or rows if vertical) allowed for the display.
Draw shadows along the right and bottom edge of a window to give it a 3-dimensional look. (The height, etc., may not be the same as the window's actual values).
is the window to update.
is the height of the window.
is the width of the window.
is the top row of the window.
is the left column of the window.
Draw a title centered at the top of the window.
is the window to update.
is the title string to display at the top of the widget.
Write all user-defined key-bindings to the given stream, e.g., as part of dlg_create_rc.
is the stream on which to write the bindings.
Given the character-offset in the string, returns the display-offset where dialog should position the cursor. In this context, "characters" may be multicolumn, since the string can be a multibyte character string.
is the string to analyze
is the character-offset
is a limit on the column positions that can be used, e.g., the window's size.
Updates the string and character-offset, given various editing characters or literal characters which are inserted at the character-offset. Returns true if an editing change was made (and the display should be updated), and false if the key was something like KEY_ENTER, which is a non-editing action outside this function.
is the (multibyte) string to update
is the character-offset
is the editing key
is true if the editing key is a function-key
is used in a special loop case by calling code to force the return value of this function when a function-key code 0 is passed in.
Given an internal exit code, check if the corresponding environment variable is set. If so, remap the exit code to match the environment variable. Finally call exit with the resulting exit code.
is the internal exit code, e.g., DLG_EXIT_OK, which may be remapped.
The dialog program uses this function to allow shell scripts to remap the exit codes so they can distinguish ESC from ERROR.
Map the given button index for dlg_exit_label into dialog's exit-code.
is the button index
Return a list of button labels. If dialog_var.extra_button is true, return the result of dlg_ok_labels. Otherwise, return a list with the "Exit" label and (if dialog_vars.help_button is set) the "Help" button as well.
Quit program killing all tailboxbg widgets.
is the format of the printf-like message to write.
Given the character-offset to find in the list, return the corresponding array index.
contains a list of character-offsets, i.e., indices into a string that denote the beginning of multibyte characters.
is the last index into list to search.
is the character-offset to find.
Cancel the local data saved by dlg_last_getc.
This entrypoint provides the --editbox functionality without the limitations of dialog's command-line syntax (compare to dialog_editbox).
is the title string to display at the top of the widget.
is a pointer to an array of char * pointers. The array is allocated by the caller, and so are the strings to which it points. The dlg_editbox function may reallocate the array and the strings.
points to the nominal length of list. The referenced value is updated iflist is reallocated.
is the desired height of the box. If zero, the height is adjusted to use the available screen size.
is the desired width of the box. If zero, the height is adjusted to use the available screen size.
This entrypoint provides the --form functionality without the limitations of dialog's command-line syntax (compare to dialog_form).
is the title string to display at the top of the widget.
is the prompt text shown within the widget.
is the desired height of the box. If zero, the height is adjusted to use the available screen size.
is the desired width of the box. If zero, the height is adjusted to use the available screen size.
is the minimum height to reserve for displaying the list. If zero, it is computed based on the given height and width.
is the number of items.
This is a list of the items to display in the form.
The widget sets the referenced location to the index of the current display item (cursor) when it returns.
Free data allocated by dlg_align_columns.
This is the array which was reformatted. It points to the first string to free.
This is the size of the struct for each row of the array.
This is the number of rows in the array.
Free memory owned by a list of DIALOG_FORMITEM's.
is the list to free.
Read a character from the given window. Handle repainting here (to simplify things in the calling application). Also, if input-callback(s) are set up, poll the corresponding files and handle the updates, e.g., for displaying a tailbox. Returns the key-code.
is the window within which to read.
as a side-effect, set this to true if the key-code is really a function-key.
passes the given key-code ch to the current window that has established a callback. If the callback returns zero, remove it and try the next window. If no more callbacks remain, return. If any callbacks were found, return true, otherwise false.
is the key-code
is true if the key is a function-key
is used to pass an exit-code to the caller, which should pass that via dlg_exit.
Build a list of the display-columns for the given multibyte string's characters.
is the string to analyze
Build an index of the wide-characters in the string, so the caller can easily tell which byte-offset begins a given wide-character.
is the string to analyze
Draw the string for the dialog_vars.item_help feature.
is the help-message
If dialog has callbacks active, purge the list of all that are not marked to keep in the background. If any remain, run those in a background process.
stores the exit-code to pass back to the caller.
returns the most recent character that was read via dlg_getc.
Given a column limit, count the number of wide characters that can fit into that limit. The offset is used to skip over a leading character that was already written.
is the string to analyze
is the column limit
is the starting offset from which analysis should continue
Check for a key-binding. If there is no binding associated with the widget, it simply returns the given curses-key. Otherwise, it returns the result of the binding
is the window on which the binding is checked
is the curses key-code
is the corresponding dialog internal code (see DLG_KEYS_ENUM in dlg_key.h).
Limit the parameter according to dialog_vars.max_input
is the value to limit
Match a given character against the beginning of the string, ignoring case of the given character. The matching string must begin with an uppercase character.
is the character to check
is the string to search
This entrypoint provides the --menu functionality without the limitations of dialog's command-line syntax (compare to dialog_menu).
is the title string to display at the top of the widget.
is the prompt text shown within the widget.
is the desired height of the box. If zero, the height is adjusted to use the available screen size.
is the desired width of the box. If zero, the height is adjusted to use the available screen size.
is the minimum height to reserve for displaying the list. If zero, it is computed based on the given height and width.
is the number of items.
This is a list of the items to display in the form.
The widget sets the referenced location to the index of the current display item (cursor) when it returns.
Moves/resizes the given window to the given position and size.
is the window to move/resize.
is the height of the resized window.
is the width of the resized window.
y-ordinate to use for the repositioned window.
x-ordinate to use for the repositioned window.
Retrieve the big-region under the pointer.
is the row on which the mouse click occurred
is the column on which the mouse click occurred
Free the memory associated with mouse regions.
Creates a region on which the mouse-clicks will return a specifed code.
is the top-row of the region.
is the left-column of the region.
is the height of the region.
is the width of the region.
is a code used to make the region unique within a widget
is used in modes 2 (columns) and 3 (cells) to determine the width of a column/cell.
is currently unused
is used to determine how the mouse position is translated into a code (like a function-key):
1
index by lines
2
index by columns
3
index by cells
is the top-row of the region.
is the left-column of the region.
is the height of the region.
is the width of the region.
is a code used to make the region unique within a widget
Retrieve the frame under the mouse pointer
is the row of the mouse-click
is the column of the mouse-click
Sets a base for subsequent calls to dlg_mouse_mkregion, so they can make regions relative to the start of a given window.
is the left-column for the base
is the top-row for the base
is a wrapper for dlg_getc which additionally maps mouse-clicks (if the curses library supports those) into extended function-keys which encode the position according to the mode in dlg_mouse_mkbigregion. Returns the corresponding key-code.
is the window on which to perform the input
the referenced location is set to true if the key-code is an actual or extended (mouse) function-key.
This is a non-blocking variant of dlg_mouse_wgetch.
is the window on which to perform the input
the referenced location is set to true if the key-code is an actual or extended (mouse) function-key.
Check if an output-separator is needed. If dialog_vars.output_separator is set, return true. Otherwise, if dialog_vars.input_result is nonempty, return true. If neither, return false.
Create a modal window, optionally with a shadow. The shadow is created if dialog_state.use_shadow is true.
is the parent window (usually the top-level window of a widget)
is the window's height
is the window's width
is the window's top-row
is the window's left-column
Create a window, optionally with a shadow. The shadow is created if dialog_state.use_shadow is true.
is the window's height
is the window's width
is the window's top-row
is the window's left-column
Return the next index in the list of labels.
is a list of (pointers to) button labels terminated by a null pointer.
is the current button-index.
Assuming that the caller is using dlg_ok_labels to list buttons, find the next index in the list of buttons.
is the current index in the list of buttons
if negative, provides a way to enumerate extra active areas on the widget.
Map the given button index for dlg_ok_labels into dialog's exit-code.
is the button-index (which is not necessarily the same as the index in the list of labels).
Returns a list with the "Ok" label, and if dialog_vars.help_button is true, the "Help" label as well.
Return a list of button labels for the OK/Cancel group of widgets.
Decode the string as an integer, decrement if greater than zero to make a curses-ordinate from a dialog-ordinate.
Parse the parameters of the "bindkeys" configuration-file entry. This expects widget name which may be "*", followed by curses key definition and then dialog key definition.
is the parameter string to parse.
Parse the configuration file and set up variables.
Return the previous index in the list of labels.
is a list of (pointers to) button labels terminated by a null pointer.
is the current button index
Print one line of the prompt in the window within the limits of the specified right margin. The line will end on a word boundary and a pointer to the start of the next line is returned, or a NULL pointer if the end of *prompt is reached.
is the window to update.
holds the starting attributes, and is updated to reflect the final attributes applied to the string.
is the string to print
is the left margin.
is the right margin
returns the ending x-ordinate.
Find the previous button index in the list from dlg_ok_labels.
is the current index
if negative provides a way to enumerate extra active areas on the widget.
Print a string of text in a window, automatically wrap around to the next line if the string is too long to fit on one line. Note that the string may contain embedded newlines.
is the window to update.
is the string to print
is the nominal height the wrapped string is limited to
is the width that the wrapping should occur in
If dialog_vars.print_siz is true, print the given height/width (from a widget) to dialog_state.output, e.g., Size: height, width.
is the window's height
is the window's width
Print up to cols columns from text, optionally rendering dialog's escape sequences for attributes and color.
is the window to update.
is the string to print
is the column limit
holds the starting attributes, and is updated to reflect the final attributes applied to the string.
Display the background title if dialog_vars.backtitle is non-null. The background title is shown at the top of the screen.
The widget developer should call this function after dlg_register_window, for the list of button labels associated with the widget. One may bind a key to a button, e.g., "OK" for DLGK_OK,
is the window with which to associate the buttons
is the widget's binding name (usually the name of the widget).
is the list of buttons
For a given named widget's window, associate a binding table.
is the window with which to associate the buttons
is the widget's binding name (usually the name of the widget).
is the binding table
Remove a callback.
contains the callback information.
Restore dialog's variables from the given variable (see dialog_save_vars).
is the variable from which to restore.
Test a dialog internal keycode to see if it corresponds to one of the push buttons on the widget such as "OK". This is only useful if there are user-defined key bindings, since there are no built-in bindings that map directly to DLGK_OK, etc. Return true if a mapping was done.
is the dialog key to test
is true if this is a function key
store the result of the mapping in the referenced location.
Save dialog's variables into the given variable (see dialog_restore_vars).
is the variable into which to save.
Set focus on the given window, making it display above other windows on the screen.
is the parent window (usually the top-level window of a widget)
is the window on which to place focus (usually a subwindow of a widget)
Setup a fixed-buffer for the result in dialog_vars.input_result
is the new contents for the result
Displays the string, shifted as necessary, to fit within the box and show the current character-offset.
is the window within which to display
is the string to display
is the starting (character, not bytes) offset
is the window attribute to use for the string
beginning row on screen
beginning column on screen
number of columns on screen
if true, do not echo input
if true, force repaint
duplicate the string, like strdup.
is the string to duplicate
compare two strings, ignoring case.
is one string
is the other string
create a subwindow, e.g., for an input area of a widget
is the parent window
is the subwindow's height
is the subwindow's width
is the subwindow's top-row
is the subwindow's left-column
If the dialog_vars.tab_correct is true, convert tabs to single spaces. Return the converted result. The caller is responsible for freeing the string.
is the string to convert
If the parameter is non-null, opens a trace file with that name and stores the file pointer in dialog_state.trace.
If dialog_state.trace is set, translate the parameters into a printable representation, log it on a "chr" line.
is the nominal keycode value.
is nonzero if the value is really a function key. Some of these may be values declared in the DLG_KEYS_ENUM.
If dialog_state.trace is set, log a printable picture of the given window.
Change embedded "\n" substrings to '\n' characters and tabs to single spaces. If there are no "\n"s, the function strips all extra spaces, for justification. If it has "\n"'s, the function preserves extra spaces. If dialog_vars.cr_wrap is set, the function preserves '\n's.
is the string to trim
Remove the bindings for a given window.
is the window from which to remove bindings
Map the given button index for dlg_yes_labels into dialog's exit-code.
is the button index
Return a list of buttons for Yes/No labels.

SEE ALSO

dialog (1).

AUTHOR

Thomas E. Dickey

$Date: 2008/07/28 00:01:05 $