| Main index | Section 3 | 日本語 | Options |
#include <dialog.h>
Dialog is a program that will let you 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.
Here is a dialog version of Hello World:
int main(void)
{
int status;
init_dialog(stdin, stdout);
status = dialog_yesno(
"Hello, in dialog-format",
"Hello World!",
0, 0);
end_dialog();
return status;
}
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.
It is used by dialog for the command-line options "--print-text-size" and "--print-text-only".
It is used by dialog for the command-line options "--print-text-size" and "--print-text-only".
It is used by dialog for the command-line options "--print-text-size" and "--print-text-only".
The text-formatting functions (dlg_print_text, dlg_print_line, and dlg_print_autowrap) check this to decide whether to print the formatted text to dialog's output or to the curses-display.
Also, dlg_auto_size checks the flag, allowing it to be used before init_dialog is called.
It is used by dialog for the command-line options "--print-text-size" and "--print-text-only".
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:
In contrast to DIALOG_STATE, the members of DIALOG_VARS are set by command-line options in dialog.
| &#187; | If DIALOG_VARS.input_length is zero, this is a pointer to user buffer (on the stack, or static). The buffer size is assumed to be MAX_LEN, which is defined in <dialog.h>. |
| &#187; | 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. |
| &#187; | by default, the calendar treats January 1 as the first week of the year. |
| &#187; | If this variable is true, the calendar uses ISO 8601's convention. ISO 8601 numbers weeks starting with the first week in January with a Thursday in the current year. January 1 may be in the previous year. |
Some widgets (buildlist, checklist, inputmenu, menu, radiolist, treeview) display a list for which the leading capital letter in each entry is accepted as a hot-key, to quickly move the focus to that entry.
Setting this variable to TRUE disables the feature.
Normally dialog allows you to quickly move to entries on the displayed list, by matching a single character to the first character of the tag. When the --no-tags option is given, dialog matches against the first character of the description. In either case, the matchable character is highlighted.
Here is a table showing how the no_tags and no_items values interact:
Widget Fields Shown Fields Read .no_items .no_tags buildlist item tag,item 0 0* buildlist item tag,item 0 1 buildlist tag tag 1 0* buildlist tag tag 1 1 checklist tag,item tag,item 0 0 checklist item tag,item 0 1 checklist tag tag 1 0 checklist tag tag 1 1 inputmenu tag,item tag,item 0 0 inputmenu item tag,item 0 1 inputmenu tag tag 1 0 inputmenu tag tag 1 1 menu tag,item tag,item 0 0 menu item tag,item 0 1 menu tag tag 1 0 menu tag tag 1 1 radiolist tag,item tag,item 0 0 radiolist item tag,item 0 1 radiolist tag tag 1 0 radiolist tag tag 1 1 treeview item tag,item 0 0* treeview item tag,item 0 1 treeview tag tag 1 0* treeview tag tag 1 1
| * | Xdialog does not display the tag column for the analogous buildlist and treeview widgets. Dialog does the same on the command-line. However the library interface defaults to displaying the tag column. Your application can enable or disable the tag column as needed for each widget. |
| &#187; | a number (0 to 6, Sunday through Saturday using POSIX) or |
| &#187; | the special value ``locale'' (this works with systems using glibc, providing an extension to the locale command, the first_weekday value). |
| &#187; | a string matching one of the abbreviations for the day of the week shown in the calendar widget, e.g., ``Mo'' for ``Monday''. |
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.
| const char * title | |
| is the title on the top of the widget. | |
| const char * cprompt | |
| is the prompt text shown within the widget. | |
| int height | |
| is the desired height of the box. If zero, the height is adjusted to use the available screen size. | |
| int width | |
| is the desired width of the box. If zero, the height is adjusted to use the available screen size. | |
| int list_height | |
| is the minimum height to reserve for displaying the list. If zero, it is computed based on the given height and width. | |
| int item_no | |
| is the number of rows in items. | |
| char ** 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. | |
| int order_mode | |
| is reserved for future enhancements | |
| const char * title | |
| is the title on the top of the widget. | |
| const char * subtitle | |
| is the prompt text shown within the widget. | |
| int height | |
| is the height excluding the fixed-height calendar grid. | |
| int width | |
| is the overall width of the box, which is adjusted up to the calendar grid's minimum width if needed. | |
| int day | |
| 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. | |
| int month | |
| 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. | |
| int year | |
| is the initial year shown. If the value is negative, the current year is used. | |
| const char * title | |
| is the title on the top of the widget. | |
| const char * cprompt | |
| is the prompt text shown within the widget. | |
| int height | |
| is the desired height of the box. If zero, the height is adjusted to use the available screen size. | |
| int width | |
| is the desired width of the box. If zero, the height is adjusted to use the available screen size. | |
| int list_height | |
| is the minimum height to reserve for displaying the list. If zero, it is computed based on the given height and width. | |
| int item_no | |
| is the number of rows in items. | |
| int 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. | |
| flag | is either FLAG_CHECK, for checklists, or FLAG_RADIO for radiolists. |
| const char * title | |
| is the title on the top of the widget. | |
| const char * path | |
| is the preselected value to show in the input-box, which is used also to set the directory- and file-windows. | |
| int height | |
| is the height excluding the minimum needed to show the dialog box framework. If zero, the height is based on the screen size. | |
| int width | |
| is the desired width of the box. If zero, the height is based on the screen size. | |
| const char * title | |
| is the title on the top of the widget. | |
| const char * file | |
| is the name of the file from which to read. | |
| int height | |
| is the desired height of the box. If zero, the height is adjusted to use the available screen size. | |
| int width | |
| is the desired width of the box. If zero, the height is adjusted to use the available screen size. | |
| const char * title | |
| is the title on the top of the widget. | |
| const char * cprompt | |
| is the prompt text shown within the widget. | |
| int height | |
| is the desired height of the box. If zero, the height is adjusted to use the available screen size. | |
| int width | |
| is the desired width of the box. If zero, the height is adjusted to use the available screen size. | |
| int form_height | |
| is the minimum height to reserve for displaying the list. If zero, it is computed based on the given height and width. | |
| int item_no | |
| is the number of rows in items. | |
| int 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. | |
| const char * title | |
| is the title on the top of the widget. | |
| const char * path | |
| is the preselected value to show in the input-box, which is used also to set the directory- and file-windows. | |
| int height | |
| is the height excluding the minimum needed to show the dialog box framework. If zero, the height is based on the screen size. | |
| int width | |
| is the desired width of the box. If zero, the height is based on the screen size. | |
| const char * title | |
| is the title on the top of the widget. | |
| const char * cprompt | |
| is the prompt text shown within the widget. | |
| int height | |
| is the desired height of the box. If zero, the height is based on the screen size. | |
| int width | |
| is the desired width of the box. If zero, the height is based on the screen size. | |
| int percent | |
| is the percentage to show in the progress bar. | |
| const char * title | |
| is the title on the top of the widget. | |
| const char * cprompt | |
| is the prompt text shown within the widget. | |
| int height | |
| is the desired height of the box. If zero, the height is based on the screen size. | |
| int width | |
| is the desired width of the box. If zero, the height is based on the screen size. | |
| const char * init | |
| is the initial value of the input box, whose length is taken into account when auto-sizing the width of the dialog box. | |
| int password | |
| if true, causes typed input to be echoed as asterisks. | |
| const char * title | |
| is the title on the top of the widget. | |
| const char * file | |
| is the name of a file containing the text to display. This function is internally bound to F1 (function key ``1''), passing dialog_vars.help_file as a parameter. The dialog program sets that variable when the --hfile option is given. | |
| int height | |
| is the desired height of the box. If zero, the height is based on the screen size. | |
| int width | |
| is the desired width of the box. If zero, the height is based on the screen size. | |
| const char * title | |
| is the title on the top of the widget. | |
| const char * cprompt | |
| is the prompt text shown within the widget. | |
| int height | |
| is the desired height of the box. If zero, the height is based on the screen size. | |
| int width | |
| is the desired width of the box. If zero, the height is based on the screen size. | |
| int menu_height | |
| is the minimum height to reserve for displaying the list. If zero, it is computed based on the given height and width. | |
| int item_no | |
| is the number of rows in items. | |
| int 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. | |
| const char * title | |
| is the title on the top of the widget. | |
| const char * cprompt | |
| is the prompt text shown within the widget. | |
| int height | |
| is the desired height of the box. If zero, the height is adjusted to use the available screen size. | |
| int width | |
| is the desired width of the box. If zero, the height is adjusted to use the available screen size. | |
| int form_height | |
| is the minimum height to reserve for displaying the list. If zero, it is computed based on the given height and width. | |
| int item_no | |
| is the number of rows in items. | |
| int 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. | |
| const char * title | |||||||||||||||||||||
| is the title on the top of the widget. | |||||||||||||||||||||
| const char * cprompt | |||||||||||||||||||||
| is the caption text shown within the widget. | |||||||||||||||||||||
| int height | |||||||||||||||||||||
| is the desired height of the box. If zero, the height is based on the screen size. | |||||||||||||||||||||
| int width | |||||||||||||||||||||
| is the desired width of the box. If zero, the height is based on the screen size. | |||||||||||||||||||||
| int percent | |||||||||||||||||||||
| is the percentage to show in the progress bar. | |||||||||||||||||||||
| int item_no | |||||||||||||||||||||
| is the number of rows in items. | |||||||||||||||||||||
| int 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 through 9 are the following strings
| |||||||||||||||||||||
| A string with a leading "-" character is centered, marked with "%". For example, "-75" is displayed as "75%". Other strings are displayed as is. | |||||||||||||||||||||
| const char * title | |
| is the title on the top of the widget. | |
| const char * cprompt | |
| is the prompt text shown within the widget. | |
| int height | |
| is the desired height of the box. If zero, the height is based on the screen size. | |
| int width | |
| is the desired width of the box. If zero, the height is based on the screen size. | |
| int pauseopt | |
| 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''. | |
| const char * title | |
| is the title on the top of the widget. | |
| int height | |
| is the desired height of the box. If zero, the height is based on the screen size. | |
| int width | |
| is the desired width of the box. If zero, the height is based on the screen size. | |
| int seconds | |
| is the timeout to use for the progress bar. | |
| const char * title | |
| is the title on the top of the widget. | |
| const char * cprompt | |
| is the prompt text shown within the widget. If empty or null, no prompt is shown. | |
| const char * command | |
| is the name of the command to execute. | |
| int height | |
| is the desired height of the box. If zero, the height is based on the screen size. | |
| int width | |
| is the desired width of the box. If zero, the height is based on the screen size. | |
| int pauseopt | |
| if true, an ``OK'' button will be shown, and the dialog will wait for it to complete. | |
| const char * title | |
| is the title on the top of the widget. | |
| const char * cprompt | |
| is the prompt text shown within the widget. If empty or null, no prompt is shown. | |
| int height | |
| is the desired height of the box. If zero, the height is based on the screen size. | |
| int width | |
| is the desired width of the box. If zero, the height is based on the screen size. | |
| const char * title | |
| is the title on the top of the widget. | |
| const char * cprompt | |
| is the prompt text shown within the widget. If empty or null, no prompt is shown. | |
| int height | |
| is the desired height of the widget. If zero, the height is based on the screen size. | |
| int width | |
| is the desired width of the widget. If zero, the height is based on the screen size. | |
| int min_value | |
| is the minimum value to allow. | |
| int max_value | |
| is the maximum value to allow. | |
| int default_value | |
| is the default value, if no change is made. | |
| const char * title | |
| is the title on the top of the widget. | |
| const char * file | |
| is the name of the file to display in the dialog. | |
| int height | |
| is the desired height of the box. If zero, the height is based on the screen size. | |
| int width | |
| is the desired width of the box. If zero, the height is based on the screen size. | |
| int bg_task | |
| 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. | |
| const char * title | |
| is the title on the top of the widget. | |
| const char * file | |
| is the name of the file to display in the dialog. | |
| int height | |
| is the desired height of the box. If zero, the height is based on the screen size. | |
| int width | |
| is the desired width of the box. If zero, the height is based on the screen size. | |
| const char * title | |
| is the title on the top of the widget. | |
| const char * subtitle | |
| is the prompt text shown within the widget. | |
| int height | |
| is the desired height of the box. If zero, the height is based on the screen size. | |
| int width | |
| is the desired width of the box. If zero, the height is based on the screen size. | |
| int hour | |
| is the initial hour shown. If the value is negative, the current hour is used. Returns DLG_EXIT_ERROR if the value specified is greater than or equal to 24. | |
| int minute | |
| is the initial minute shown. If the value is negative, the current minute is used. Returns DLG_EXIT_ERROR if the value specified is greater than or equal to 60. | |
| int second | |
| is the initial second shown. If the value is negative, the current second is used. Returns DLG_EXIT_ERROR if the value specified is greater than or equal to 60. | |
| const char * title | |
| is the title on the top of the widget. | |
| const char * cprompt | |
| is the prompt text shown within the widget. | |
| int height | |
| is the desired height of the box. If zero, the height is based on the screen size. | |
| int width | |
| is the desired width of the box. If zero, the height is based on the screen size. | |
| int list_height | |
| is the minimum height to reserve for displaying the list. If zero, it is computed based on the given height and width. | |
| int item_no | |
| is the number of rows in items. | |
| char ** items | |
| is the list of items, contain tag, name, and optionally help strings (if dialog_vars.item_help is set). The initial selection state for each item is also in this list. | |
| int flag | |
| flag | is either FLAG_CHECK, for checklists (multiple selections), or FLAG_RADIO for radiolists (a single selection). |
| const char * title | |
| is the title on the top of the widget. | |
| const char * cprompt | |
| is the prompt text shown within the widget. | |
| int height | |
| is the desired height of the box. If zero, the height is based on the screen size. | |
| int width | |
| is the desired width of the box. If zero, the height is based on the screen size. | |
The only non-widget function whose name begins with "dialog_" is dialog_version, which returns the version number of the library as a string.
A few functions are prefixed "_dlg_", because they are required for internal use, but not intended as part of the library application programming interface.
Here is a brief summary of the utility functions and their parameters:
| DIALOG_CALLBACK *p | |
| contains the callback information. | |
| DIALOG_CALLBACK **p | |
| points to the callback information. This is a reference to the pointer so that the caller's pointer can be zeroed when input ends. | |
| DIALOG_FREEBACK func | |
| function to call when input ends, e.g., to free caller's additional data. | |
| int *result | |
| this is updated to DLG_EXIT_ITEM_HELP if DIALOG_VARS.item_help is set. | |
| char **tag | |
| the tag- or help-text is stored here. | |
| DIALOG_FORMITEM *item | |
| contains the list item to use for tag- or help-text. | |
| int *result | |
| this is updated to DLG_EXIT_ITEM_HELP if DIALOG_VARS.item_help is set. | |
| char **tag | |
| the tag- or help-text is stored here. | |
| DIALOG_LISTITEM *item | |
| contains the list item to use for tag- or help-text. | |
| int mode | |||||||||
controls the way the last key report is separated from other results:
| |||||||||
| char * string | |
| is the string to add. | |
| char * string | |
| is the string to add. | |
| char * string | |
| is the string to add. | |
| Caveat: This function is only implemented for 8-bit characters. | |
| char **target | |
| This is the array to reformat. It points to the first string to modify. | |
| int per_row | |
| This is the size of the struct for each row of the array. | |
| int num_rows | |
| This is the number of rows in the array. | |
| const char * title | |
| is the title string to display at the top of the widget. | |
| const char * cprompt | |
| is the prompt text shown within the widget. | |
| int height | |
| is the desired height of the box. If zero, the height is adjusted to use the available screen size. | |
| int width | |
| is the desired width of the box. If zero, the height is adjusted to use the available screen size. | |
| int percent | |
| is the percentage to show in the progress bar. | |
| chtype ch | |
| is the parameter, usually one of the ACS_xxx constants. | |
| WINDOW * win | |
| is the window to update. | |
| int height | |
| is the number of rows to update. | |
| int width | |
| is the number of columns to update. | |
| chtype attr | |
| is the attribute, e.g., A_BOLD. | |
Dialog sets dialog_state.text_height and dialog_state.text_width for the formatted prompt as a side-effect.
Normally dialog writes the formatted prompt to the curses window, but it will write the formatted prompt to the output stream if dialog_state.text_only is set.
| const char * title | |||||||
| is the title string to display at the top of the widget. | |||||||
| const char * prompt | |||||||
| is the message text which will be displayed in the widget, used here to determine how large the widget should be. | |||||||
| If the value is NULL, dialog allows the widget to use the whole screen, i.e., if the values referenced by height and/or width are zero. | |||||||
| int * height | |||||||
is the nominal height.
Dialog checks the referenced value and may update it:
| |||||||
| int * width | |||||||
is the nominal width.
Dialog checks the referenced value and may update it:
| |||||||
| int boxlines | |||||||
| is the number of lines to reserve in the vertical direction. | |||||||
| int mincols | |||||||
| is the minimum number of columns to use. | |||||||
| const char * title | |
| is the title string to display at the top of the widget. | |
| const char * file | |
| is the name of the file. | |
| int * height | |
| 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). | |
| If it is greater than zero, limit the referenced value to the screen-height after verifying that the file exists. | |
| int * width | |
| 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). | |
| If it is greater than zero, limit the referenced value to the screen-width after verifying that the file exists. | |
| int boxlines | |
| is the number of lines to reserve on the screen for drawing boxes. | |
| int mincols | |
| is the number of columns to reserve on the screen for drawing boxes. | |
| &#187; | if neither dialog_vars.ascii_lines nor dialog_vars.no_lines is set. |
| &#187; | if dialog_vars.ascii_lines is set, returns the corresponding "+" or "-", etc., for the line-drawing characters used in dialog. |
| &#187; | otherwise, if dialog_vars.no_lines is set, returns a space for the line-drawing characters. |
| &#187; | if the parameter is not a line-drawing or other special character such as ACS_DARROW, it returns the parameter unchanged. |
| int width | |
| is the width of the widget. | |
| int height | |
| is the height of the widget. | |
| const char * title | |
| is the title string to display at the top of the widget. | |
| const char * cprompt | |
| is the prompt text shown within the widget. | |
| int height | |
| is the desired height of the box. If zero, the height is adjusted to use the available screen size. | |
| int width | |
| is the desired width of the box. If zero, the height is adjusted to use the available screen size. | |
| int list_height | |
| is the minimum height to reserve for displaying the list. If zero, it is computed based on the given height and width. | |
| int item_no | |
| is the number of rows in items. | |
| DIALOG_LISTITEM * items | |
| is the list of items, contain tag, name, and optionally help strings (if dialog_vars.item_help is set). The initial selection state for each item is also in this list. | |
| const char * states | |
| This is a list of characters to display for the given states. Normally a buildlist 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. | |
| int order_mode | |
| is reserved for future enhancements | |
| int * current_item | |
| The widget sets the referenced location to the index of the current display item (cursor) when it returns. | |
| const char ** labels | |
| is a list of (pointers to) button labels terminated by a null pointer. | |
See dlg_ok_buttoncode, which maps settings for ok/extra/help and button number into exit-code.
| const char ** labels | |
| is a list of (pointers to) button labels terminated by a null pointer. | |
| int * limit | |
| the function sets the referenced limit to the width required for the buttons (limited by the screen size) if that is wider than the passed-in limit. | |
| const char ** labels | |
| is a list of (pointers to) button labels terminated by a null pointer. | |
| int vertical | |
| is true if the buttons are arranged in a column rather than a row. | |
| int * longest | |
| Return the total number of columns in the referenced location. | |
| int * length | |
| Return the longest button's columns in the referenced location. | |
Normally dlg_draw_buttons and dlg_char_to_button use the first uppercase character. However, they keep track of all of the labels and if the first has already been used in another label, they will continue looking for another uppercase character. This function does not have enough information to make that check.
| const char * label | |
| is the label to test. | |
| const char ** labels | |
| is a list of (pointers to) button labels terminated by a null pointer. | |
| int limit | |
| is the maximum number of columns to allow for the buttons. | |
| int * gap | |
| store the nominal gap between buttons in the referenced location. This is constrained to be at least one. | |
| int * margin | |
| store the left+right total margins (for the list of buttons) in the referenced location. | |
| int * step | |
| store the step-size in the referenced location. | |
| int item_no | |
| is the number of items. | |
| DIALOG_LISTITEM * 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. | |
| If dialog_vars.no_items is set, the text fields in the list are ignored. | |
| int * height | |
| 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. | |
| int * list_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. | |
| int item_no | |
| is the number of items in the list. | |
| int item_no | |
| is the number of items. | |
| char ** items | |
| is a list of character pointers. | |
| int group | |
| is the number of items in each group, e.g., the second array index. | |
| int ch | |
| is the character to find. | |
| const char ** labels | |
| is a list of (pointers to) button labels terminated by a null pointer. | |
| const char * title | |
| is the title string to display at the top of the widget. | |
| const char * cprompt | |
| is the prompt text shown within the widget. | |
| int height | |
| is the desired height of the box. If zero, the height is adjusted to use the available screen size. | |
| int width | |
| is the desired width of the box. If zero, the height is adjusted to use the available screen size. | |
| int list_height | |
| is the minimum height to reserve for displaying the list. If zero, it is computed based on the given height and width. | |
| int item_no | |
| is the number of items. | |
| DIALOG_LISTITEM * items | |
| This is a list of the items to display in the checklist. | |
| const char * states | |
| 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. | |
| int flag | |
| This is should be one of FLAG_CHECK or FLAG_RADIO, depending on whether the widget should act as a checklist or radiobox. | |
| int * current_item | |
| The widget sets the referenced location to the index of the current display item (cursor) when it returns. | |
DLGK_PAGE_FIRST,
DLGK_PAGE_LAST,
DLGK_GRID_UP,
DLGK_GRID_DOWN,
DLGK_PAGE_PREV or
DLGK_PAGE_NEXT.
Some widgets use these key bindings for scrolling the prompt-text up and down, to allow for display in very small windows.
The function returns 0 (zero) if it finds one of these keys, and -1 if not.
| int key | |
| is the function-key to check | |
| int last | |
| is the number of lines which would be used to display the scrolled prompt in an arbitrarily tall window. It is used here to check limits for the offset value. | |
| int page | |
| this is the available height for writing scrolled text, which is smaller than the window if it contains buttons. | |
| bool * show | |
| on return, holds TRUE if dlg_print_scrolled should be used to redisplay the prompt text. | |
| int * offset | |
| on entry, holds the starting line number (counting from zero) last used for dlg_print_scrolled. On return, holds the updated starting line number. | |
| argv | Points to the argument vector. |
| const char * string | |
| is the string to measure. | |
| const char * string | |
| is the string to measure. | |
| const char * string | |
| is the string to measure. | |
| const char * filename | |
| is the name of the file to write to. | |
| int height | |
| is the window's height | |
| int width | |
| is the window's width | |
| DIALOG_FORMITEM * items | |
| is the list of items to search. It is terminated by an entry with a null name field. | |
| char ** items | |
| is the list of items to search. | |
| int llen | |
| is the number of items in each group, e.g., the second array index. | |
| WINDOW * win | |
| is the window to remove. | |
| WINDOW * win | |
| is the parent window | |
| int height | |
| is the subwindow's height | |
| int width | |
| is the subwindow's width | |
| int y | is the subwindow's top-row |
| int x | is the subwindow's left-column |
| WINDOW * dialog | |
| is the window on which to draw an arrow. | |
| int top_arrow | |
| is true if an up-arrow should be drawn at the top of the window. | |
| int bottom_arrow | |
| is true if an down-arrow should be drawn at the bottom of the window. | |
| int x | is the zero-based column within the window on which to draw arrows. |
| int top | |
| 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. | |
| int bottom | |
| 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. | |
| WINDOW * dialog | |
| is the window on which to draw an arrow. | |
| int top_arrow | |
| is true if an up-arrow should be drawn at the top of the window. | |
| int bottom_arrow | |
| is true if an down-arrow should be drawn at the bottom of the window. | |
| int x | is the zero-based column within the window on which to draw arrows. |
| int top | |
| 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. | |
| int bottom | |
| 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. | |
| chtype attr | |
| is the window's background attribute. | |
| chtype borderattr | |
| is the window's border attribute. | |
| WINDOW * win | |
| is the window to update. | |
| WINDOW * win | |
| is the window to update. | |
| chtype on_left | |
| is used to color the upper/left edges of the box, i.e., the tee-element and horizontal line | |
| chtype on_right | |
| is used to color the right edge of the box, i.e., the tee-element | |
| chtype on_inside | |
| is used to fill-color the inside of the box | |
| WINDOW * win | |
| is the window to update. | |
| int y | is the top row of the box. |
| int x | is the left column of the box. |
| int height | |
| is the height of the box. | |
| int width | |
| is the width of the box. | |
| chtype boxchar | |
| is used to color the right/lower edges. It also is fill-color used for the box contents. | |
| chtype borderchar | |
| is used to color the upper/left edges. | |
| WINDOW * win | |
| is the window to update. | |
| int y | is the top row of the box. |
| int x | is the left column of the box. |
| int height | |
| is the height of the box. | |
| int width | |
| is the width of the box. | |
| chtype boxchar | |
| is used to fill-color for the box contents. | |
| chtype borderchar | |
| is used to color the upper/left edges. | |
| chtype borderchar2 | |
| is used to color the right/lower edges. | |
| WINDOW * win | |
| is the window to update. | |
| int y | is the starting row. |
| int x | is the starting column. |
| const char ** labels | |
| is a list of (pointers to) button labels terminated by a null pointer. | |
| int selected | |
| is the index within the list of the selected button. | |
| int vertical | |
| is true if the buttons are arranged in a column rather than a row. | |
| int limit | |
| is the number of columns (or rows if vertical) allowed for the display. | |
| WINDOW * dialog | |
| is the window to modify. | |
| bool decorations | |
| if true, allow room for the scrolling arrows. | |
| WINDOW * win | |
| is the window in which the data is scrolled. Because left, right, top, bottom are passed as parameters, this window can contain additional data. | |
| long first_data | |
| is the zero-based index to the first row of data in the current window. | |
| long this_data | |
| is the zero-based index to the current row of data. | |
| long next_data | |
| is the zero-based index to the next data after the current row. | |
| long total_data | |
| is the total number of rows of data. | |
| int left | |
| is the zero-based left margin/column of the window. The up/down arrows are draw inset by 5 columns from this point. | |
| int right | |
| is the zero-based right margin/column of the window. The scrollbar is drawn flush against this column. | |
| int top | |
| 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. | |
| int bottom | |
| 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. | |
| chtype attr | |
| is the window's background attribute. | |
| chtype borderattr | |
| is the window's border attribute. | |
| WINDOW * win | |
| is the window to update. | |
| int height | |
| is the height of the window. | |
| int width | |
| is the width of the window. | |
| int y | is the top row of the window. |
| int x | is the left column of the window. |
| WINDOW * win | |
| is the window to update. | |
| const char * title | |
| is the title string to display at the top of the widget. | |
The function should only return DLG_EXIT_ERROR.
| DIALOG_LISTITEM * items | |
| is the list of menu items | |
| int current | |
| is the index of the currently-selected item | |
| char * newtext | |
| is the updated text for the menu item | |
| FILE * fp | |
| is the stream on which to write the bindings. | |
| FILE * fp | |
| is the stream on which to write the bindings. | |
| WINDOW * win | |
| is the window for which bindings should be dumped. If it is null, then only built-in bindings are dumped. | |
| int * argcp | |
| in/out parameter giving the length of the argument vector. char *** argvp in/out parameter pointing to the argument vector. int start starting index. int count number of arguments to remove. | |
| char * string | |
| is the string to analyze | |
| int offset | |
| is the character-offset | |
| int x_last | |
| is a limit on the column positions that can be used, e.g., the window's size. | |
| char * string | |
| is the (multibyte) string to update | |
| int * offset | |
| is the character-offset | |
| int key | |
| is the editing key | |
| int fkey | |
| is true if the editing key is a function-key | |
| bool force | |
| 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. | |
| int code | |
| is the internal exit code, e.g., DLG_EXIT_OK, which may be remapped. | |
| int code | |
| is an exit-code for dialog as defined in <dialog.h>. | |
| const char * name | |
| is the name of an exit-code for dialog as defined in <dialog.h> but omitting the ``DLG_EXIT_'' prefix. | |
| int button | |
| is the button index | |
| const char * fmt | |
| is the format of the printf-like message to write. | |
| ... | are the variables to apply to the fmt format. |
| const int *list | |
| contains a list of character-offsets, i.e., indices into a string that denote the beginning of multibyte characters. | |
| int limit | |
| is the last index into list to search. | |
| int to_find | |
| is the character-offset to find. | |
| const char * string | |
| is the address of the string whose data should be discarded. The address rather than contents is used as the unique identifier because some of the caching is used for editable input-fields. | |
| const char * title | |
| is the title string to display at the top of the widget. | |
| char *** list | |
| 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. | |
| int * rows | |
| points to the nominal length of list. The referenced value is updated iflist is reallocated. | |
| int height | |
| is the desired height of the box. If zero, the height is adjusted to use the available screen size. | |
| int width | |
| is the desired width of the box. If zero, the height is adjusted to use the available screen size. | |
| const char * title | |
| is the title string to display at the top of the widget. | |
| const char * cprompt | |
| is the prompt text shown within the widget. | |
| int height | |
| is the desired height of the box. If zero, the height is adjusted to use the available screen size. | |
| int width | |
| is the desired width of the box. If zero, the height is adjusted to use the available screen size. | |
| int form_height | |
| is the minimum height to reserve for displaying the list. If zero, it is computed based on the given height and width. | |
| int item_no | |
| is the number of items. | |
| DIALOG_FORMITEM * items | |
| This is a list of the items to display in the form. | |
| int * current_item | |
| The widget sets the referenced location to the index of the current display item (cursor) when it returns. | |
| char **target | |
| This is the array which was reformatted. It points to the first string to free. | |
| int per_row | |
| This is the size of the struct for each row of the array. | |
| int num_rows | |
| This is the number of rows in the array. | |
| DIALOG_FORMITEM * items | |
| is the list to free. | |
| void *objptr | |
| points to the gauge widget. | |
| WINDOW * win | |
| is the window within which to read. | |
| int * fkey | |
| as a side-effect, set this to true if the key-code is really a function-key. | |
| &#187; | If the caller provides a pointer in the second parameter, return success/failure for the function return, and the actual value via the pointer. Use this for decoding arbitrary numbers, e.g., negative or zero. |
| &#187; | If the caller does not provide a pointer, return the decoded value for the function-return. Use this when only values greater than zero are useful. |
| char * name | |
| is the name of the environment-variable to retrieve. | |
| int * value | |
| is the optional pointer to a return-value. | |
| char * name | |
| is the name of the environment-variable to retrieve. | |
| WINDOW * win | |
| is the window from which to get attributes. | |
| int ch | |
| is the key-code | |
| int fkey | |
| is true if the key is a function-key | |
| int * result | |
| is used to pass an exit-code to the caller, which should pass that via dlg_exit. | |
| const char * string | |
| is the string to analyze | |
| const char * string | |
| is the string to analyze | |
| const char * txt | |
| is the help-message | |
| FILE * output | |
| is the output stream used for displaying widgets. It is either stdout or stderr, depending on the --stdout option. | |
| int * retval | |
| stores the exit-code to pass back to the caller. | |
| const char * string | |
| is the string to analyze | |
| int limit | |
| is the column limit | |
| int offset | |
| is the starting offset from which analysis should continue | |
| WINDOW * win | |
| is the window on which the binding is checked | |
| int curses_key | |
| is the curses key-code | |
| int * dialog_key | |
| is the corresponding dialog internal code (see DLG_KEYS_ENUM in dlg_key.h). | |
| int max_len | |
| is the value to limit | |
| int ch | |
| is the character to check | |
| const char * string | |
| is the string to search | |
| const char * title | |
| is the title string to display at the top of the widget. | |
| const char * cprompt | |
| is the prompt text shown within the widget. | |
| int height | |
| is the desired height of the box. If zero, the height is adjusted to use the available screen size. | |
| int width | |
| is the desired width of the box. If zero, the height is adjusted to use the available screen size. | |
| int menu_height | |
| is the minimum height to reserve for displaying the list. If zero, it is computed based on the given height and width. | |
| int item_no | |
| is the number of items. | |
| DIALOG_LISTITEM * items | |
| This is a list of the items to display in the form. | |
| int * current_item | |
| The widget sets the referenced location to the index of the current display item (cursor) when it returns. | |
| DIALOG_INPUTMENU rename_menutext | |
| If this is not dlg_dummy_menutext, the widget acts like an inputmenu widget, providing an extra ``Rename'' button, which activates an edit feature on the selected menu item. | |
| WINDOW *win | |
| is the window to move/resize. | |
| WINDOW *height | |
| is the height of the resized window. | |
| WINDOW *width | |
| is the width of the resized window. | |
| WINDOW *y | |
| y-ordinate to use for the repositioned window. | |
| WINDOW *x | |
| x-ordinate to use for the repositioned window. | |
| int y | is the row on which the mouse click occurred |
| int x | is the column on which the mouse click occurred |
| int y | is the top-row of the region. | ||||||
| int x | is the left-column of the region. | ||||||
| int height | |||||||
| is the height of the region. | |||||||
| int width | |||||||
| is the width of the region. | |||||||
| int code | |||||||
| is a code used to make the region unique within a widget | |||||||
| int step_x | |||||||
| is used in modes 2 (columns) and 3 (cells) to determine the width of a column/cell. | |||||||
| int step_y | |||||||
| is currently unused | |||||||
| int mode | |||||||
is used to determine how the mouse position is translated into
a code (like a function-key):
| |||||||
| int y | is the top-row of the region. |
| int x | is the left-column of the region. |
| int height | |
| is the height of the region. | |
| int width | |
| is the width of the region. | |
| int code | |
| is a code used to make the region unique within a widget | |
| int y | is the row of the mouse-click |
| int x | is the column of the mouse-click |
| int x | is the left-column for the base |
| int y | is the top-row for the base |
| int code | |
| is the value to add to dlg_mouse_mkregion's code parameter. | |
| WINDOW * win | |
| is the window on which to perform the input | |
| int * fkey | |
| the referenced location is set to true if the key-code is an actual or extended (mouse) function-key. | |
| WINDOW * win | |
| is the window on which to perform the input | |
| int * fkey | |
| the referenced location is set to true if the key-code is an actual or extended (mouse) function-key. | |
| WINDOW * parent | |
| is the parent window (usually the top-level window of a widget) | |
| int height | |
| is the window's height | |
| int width | |
| is the window's width | |
| int y | is the window's top-row |
| int x | is the window's left-column |
| int height | |
| is the window's height | |
| int width | |
| is the window's width | |
| int y | is the window's top-row |
| int x | is the window's left-column |
| const char ** labels | |
| is a list of (pointers to) button labels terminated by a null pointer. | |
| int button | |
| is the current button-index. | |
| int current | |
| is the current index in the list of buttons | |
| int extra | |
| if negative, provides a way to enumerate extra active areas on the widget. | |
| int button | |
| is the button-index (which is not necessarily the same as the index in the list of labels). | |
| char * params | |
| is the parameter string to parse. | |
| const char *command | |
| The shell command to run. | |
| const char *type | |
| Like popen, "r" is used to read, and "w" is used to write. | |
| const char ** labels | |
| is a list of (pointers to) button labels terminated by a null pointer. | |
| int button | |
| is the current button index | |
| WINDOW *win | |
| the window in which to display the text | |
| const char *text | |
| the value to display | |
| int climit | |
| the number of columns available for printing the text | |
| bool first | |
| true if this is the first call (for ``tag'' and ``description''), and the first character of the value should be highlighted. | |
| int selected | |
| nonzero if the text should be displayed using the ``selected'' colors | |
See dlg_check_scrolled for a function which updates the offset variable used as a parameter here. It complements this function; you need both. If pauseopt is set, this function returns an updated last parameter, needed for dlg_check_scrolled calls.
| WINDOW * win | |
| is the window to update. | |
| const char * prompt | |
| is the string to print | |
| int offset | |
| is the starting line-number to write wrapped text. | |
| int height | |
| is the available height for writing the wrapped text | |
| int width | |
| is the width that the wrapping should occur in | |
| int pauseopt | |
| is true if the extra functionality for scrolling should be enabled. If false, this calls dlg_print_autowrap without doing any scrolling. | |
| WINDOW *win | |
| is the window to update. | |
| chtype *attr | |
| holds the starting attributes, and is updated to reflect the final attributes applied to the string. | |
| const char *prompt | |
| is the string to print | |
| int lm | |
| is the left margin. | |
| int rm | |
| is the right margin | |
| int *x | |
| returns the ending x-ordinate. | |
| int current | |
| is the current index | |
| int extra | |
| if negative provides a way to enumerate extra active areas on the widget. | |
| WINDOW * win | |
| is the window to update. | |
| const char * prompt | |
| is the string to print | |
| int height | |
| is the nominal height the wrapped string is limited to | |
| int width | |
| is the width that the wrapping should occur in | |
| int height | |
| is the window's height | |
| int width | |
| is the window's width | |
| WINDOW * win | |
| is the window to update. | |
| const char * txt | |
| is the string to print | |
| int col | |
| is the column limit | |
| chtype * attr | |
| holds the starting attributes, and is updated to reflect the final attributes applied to the string. | |
| const char * title | |
| is the title on the top of the widget. | |
| const char * cprompt | |
| is the prompt text shown within the widget. If empty or null, no prompt is shown. | |
| int height | |
| is the desired height of the box. If zero, the height is based on the screen size. | |
| int width | |
| is the desired width of the box. If zero, the height is based on the screen size. | |
| int pauseopt | |
| 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 ``programbox'', without an ``OK'' button, it is denoted a ``progressbox''. | |
| FILE * fp | |
| is the file pointer, which may be a pipe or a regular file. | |
| void ** objptr | |
| If the pointer referenced by this parameter is null, the function creates a new gauge widget using dlg_allocate_gauge. Otherwise, it updates the title and cprompt values, reusing the window from the previous call on this function. As a side-effect, the function stores the updated object-pointer via the objptr parameter. | |
| const char * title | |
| is the title string to display at the top of the widget. | |
| const char * cprompt | |
| is the prompt text shown within the widget. | |
| int height | |
| is the desired height of the box. If zero, the height is adjusted to use the available screen size. | |
| int width | |
| is the desired width of the box. If zero, the height is adjusted to use the available screen size. | |
| int percent | |
| is the percentage to show in the progress bar. | |
| WINDOW * win | |
| is the window with which to associate the buttons | |
| const char * name | |
| is the widget's binding name (usually the name of the widget). | |
| const char ** buttons | |
| is the list of buttons | |
| WINDOW * win | |
| is the window with which to associate the buttons | |
| const char * name | |
| is the widget's binding name (usually the name of the widget). | |
| DLG_KEYS_BINDING * binding | |
| is the binding table | |
| DIALOG_CALLBACK * p | |
| contains the callback information. | |
The function should add ``RENAMED'' to dialog_vars.input_result , followed by the menu item's name and the newtext value (with a space separating the three items), and return DLG_EXIT_EXTRA.
| DIALOG_LISTITEM * items | |
| is the list of menu items | |
| int current | |
| is the index of the currently-selected item | |
| char * newtext | |
| is the updated text for the menu item | |
| DIALOG_VARS * save | |
| is the variable from which to restore. | |
| int dialog_key | |
| is the dialog key to test | |
| int fkey | |
| is true if this is a function key | |
| int * resultp | |
| store the result of the mapping in the referenced location. | |
| DIALOG_VARS * save | |
| is the variable into which to save. | |
| WINDOW * parent | |
| is the parent window (usually the top-level window of a widget) | |
| WINDOW * win | |
| is the window on which to place focus (usually a subwindow of a widget) | |
| const char * string | |
| is the new contents for the result | |
| WINDOW * win | |
| is the window whose input-timeout should be set | |
| bool will_getc | |
| is true if the widget is expected to read keyboard characters. Some (such as the gauge widget) do not. | |
| WINDOW * win | |
| is the window within which to display | |
| const char * string | |
| is the string to display | |
| int offset | |
| is the starting (character, not bytes) offset | |
| chtype attr | |
| is the window attribute to use for the string | |
| int y_base | |
| beginning row on screen | |
| int x_base | |
| beginning column on screen | |
| int x_last | |
| number of columns on screen | |
| bool hidden | |
| if true, do not echo input | |
| bool force | |
| if true, force repaint | |
| const char * cprompt | |
| is the string to duplicate | |
| const char * a | |
| is one string | |
| const char * b | |
| is the other string | |
| &#187; | Blanks between arguments are replaced by nulls. |
| &#187; | Normally arguments are separated by blanks; however you can double-quote an argument to enclose blanks. The surrounding double-quotes are removed from the string. |
| &#187; | A backslash preceding a double-quote within double-quotes is removed. |
| &#187; | A backslash preceding a newline outside double-quotes is removed. |
| &#187; | Except for special cases, backslashes are preserved in the strings, since other dialog functions interpret backslashes, e.g., for colors. |
| char *blob | |
| is the string to convert. | |
| WINDOW * win | |
| is the parent window | |
| int height | |
| is the subwindow's height | |
| int width | |
| is the subwindow's width | |
| int y | is the subwindow's top-row |
| int x | is the subwindow's left-column |
| char * prompt | |
| is the string to convert | |
| char * name | |
| is the name to log in the comment. | |
| int value | |
| is the value to log in the comment. | |
| char * name | |
| is the name to log in the comment. | |
| int value | |
| is the value to log in the comment. | |
| int ch | |
| is the nominal keycode value. | |
| int fkey | |
| is nonzero if the value is really a function key. Some of these may be values declared in the DLG_KEYS_ENUM. | |
| const char * fmt | |
| is the format of the printf-like message to write. | |
| ... | are the variables to apply to the fmt format. |
DLG_TRACE(("this is dialog version %s\n", dialog_version()));
| const char *fmt | |
| is the format of the printf-like message to write. | |
| va_list ap | |
| are the variables to apply to the fmt format. | |
va_start(ap, fmt); dlg_trace_msg("## Error: "); dlg_trace_va_msg(fmt, ap); va_end(ap);
Unlike dlg_trace_msg, an extra macro is not needed.
| const char * title | |
| is the title on the top of the widget. | |
| const char * cprompt | |
| is the prompt text shown within the widget. | |
| int height | |
| is the desired height of the box. If zero, the height is based on the screen size. | |
| int width | |
| is the desired width of the box. If zero, the height is based on the screen size. | |
| int list_height | |
| is the minimum height to reserve for displaying the list. If zero, it is computed based on the given height and width. | |
| int item_no | |
| is the number of rows in items. | |
| DIALOG_LISTITEM * items | |
| is the list of items, contain tag, name, and optionally help strings (if dialog_vars.item_help is set). The initial selection state for each item is also in this list. | |
| const char * states | |
| This is a list of characters to display for the given states. Normally a buildlist 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. | |
| int * depths | |
| This is a list of depths of each item in the tree. It is a separate parameter from items to allow reuse of the existing functions. | |
| int flag | |
| is either FLAG_CHECK, for checklists (multiple selections), or FLAG_RADIO for radiolists (a single selection). | |
| int * current_item | |
| The widget sets the referenced location to the index of the current display item (cursor) when it returns. | |
There are several optional features:
| &#187; | Unless dialog_vars.nocollapse is set, each tab is converted to a space before other processing. | ||||||
| &#187; |
If dialog_vars.no_nl_expand is not set,
and the string has "\n" substrings:
| ||||||
| &#187; |
Otherwise, if dialog_vars.trim_whitespace is set:
| ||||||
| &#187; |
Finally
(if dialog_vars.no_nl_expand is set,
or the string does not contain "\n" substrings,
and dialog_vars.trim_whitespace is not set):
| ||||||
| char * src | |
| is the string to trim | |
| WINDOW * win | |
| is the window from which to remove bindings | |
| void *objptr | |
| points to the gauge object to update. | |
| int percent | |
| is the new percentage value to display. | |
| int button | |
| is the button index | |
| FILE *input | |
| is the real tty input of dialog. Usually it is the standard input, but if --input-fd option is used, it may be anything. | |
| FILE *output | |
| is where dialog will send its result. Usually it is the standard error, but if --stdout or --output-fd is used, it may be anything. | |
| DIALOG (3) | $Date: 2021/01/17 18:02:44 $ |
| Main index | Section 3 | 日本語 | Options |
Please direct any comments about this manual page service to Ben Bullock. Privacy policy.
