% ndialog -- libdialog compatability functions % Jessica L. Parsons % Wed Jan 16 08:45:08 PST 2008 #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](ndialog.html) and the `MENU()` display function. =dialog\_yesno()= [`dialog_yesno(title,message,height,width)`](class:example) 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()= [`dialog_msgbox(title,message,height,width,pause)`](class:example) Put up a dialog box with a message in it. If `pause` is nonzero, an **`[OK]`** button will be displayed and the function will wait until you press it, otherwise it will immediately return. =dialog\_mesgbox()= [`dialog_mesgbox(title,message,height,width)`](class:example) 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()= [`dialog_menu(title,message,height,width,menu_height,menu_items,items,result,ch,sc)`](class:example) 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()= [`dialog_checklist(title,message,height,width,list_height,nr_list,items,result)`](class:example) 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()= [`dialog_radiolist(title,message,height,width,list_height,nr_list,items,result)`](class:example) Like `dialog_checklist()`, except only one item can be checked at a time. =dialog\_gauge()= [`dialog_gauge(title,message,y,x,height,width,perc)`](class:example) Display a window that contains a progress gauge (from **0% **to **100%) =dialog\_clear\_norefresh()= [`dialog_clear_norefresh()`](class:example) clears the current window, but doesn't refresh the screen. =dialog\_clear()= [`dialog_clear()`](class:example) clears the current window and refreshes the screen. =dialog\_update()= [`dialog_update()`](class:example) updates the window, like the curses function **wrefresh** ->[Return to the main ndialog page](index.html#INDEX)<-