Dialog compatablity functions

All these functions pop up a window containing the prompt and, if appropriate, a box containing whatever the dialog wants to display. They are all built up from ndialog objects and the MENU() display function.
dialog_yesno(title,message,height,width)
Put up a dialog box asking for a yes/no answer. You can autosize the dialog box by setting height and width to -1.
dialog_msgbox(title,message,height,width,pause)
Put up a dialog box with a message in it. If pause is nonzero, a [OK] button will be displayed and the function will wait until you press it, otherwise it will immediately return.
dialog_mesgbox(title,message,height,width)

Put up a dialog box with a message in it and wait for the user to press the [OK] button.

NOTE: This is not correctly implemented. If you pass it a message string that's longer or wider than the screen, dialog_mesgbox will silently fail.

dialog_menu(title,message,height,width,menu_height,
menu_items,items,result,ch,sc)

Put up a menu box and wait for the user to select a menu item or cancel out of the box.

title
The title on the dialog window
message
A message printed at the top of the dialog window
width
How wide the window should be (-1 for autosizing)
height
How deep the window should be (-1 for autosizing)
menu_height
How many items in the menu should be visible at any time (Note that this needs to be 3 less than height, because room is needed for the [CANCEL] button and a separator line.)
menu_items
How long menu[] is.
menu
The menu items, as an array of pairs of strings. The first string (menu[x+x]) is a keyword for this menu item, the second string (menu[x+x+1]) is the description for this menu item. You need to make certain that menu contains 2*menu_items entries, or hilarious crashes will happen.
result
A string that holds the selected keyword.
ch,sc
Horrible compatability kludges to keep track of the last item selected. You need to set them to zero before you call dialog_menubox.
dialog_checklist(title,message,height,width,list_height,
nr_list,items,result)

Like dialog_menubox(), except it puts up a list of checkable items. Note that there are no ch and sc parameters, and that the menu parameter is slightly different. For dialog_checklist, menu is composed of string triples; menu[x+x] is the key, menu[x+x+1] is the description, and menu[x+x+2] is the value on to tell the function that this item is selected. If the user does not cancel out of this form, result contains a whitespace-delimited list of selected keywords.

dialog_radiolist(title,message,height,width,list_height,
nr_list,items,result)

Like dialog_checklist(), except only one item can be checked at a time.

dialog_gauge(title,message,y,x,height,width,perc)

Display a window that contains a progress gauge (from 0% to 100%)

dialog_clear_norefresh()

clears the current window, but doesn't refresh the screen.

dialog_clear()

clears the current window and refreshes the screen.

dialog_update()

updates the window, like the curses function wrefresh

Back to main ndialog page


Written March 1998 by David Parsons