Skip to content
Advertisement

Linux whiptail or dialog with menu and input together

I want to use the ‘whiptail’ package to generate a menu box and input box simultaneously on screen. Is this possible? Or maybe with dialog? I can’t find any example of this.

I want something like this: Menu item 1 Menu item 2 menu item 3

if none of the above, type your own: Inputbox:

The user could either select one of the entries from the menu or type in his own input. How do I do this?

(I did see the dialog ‘inputmenu’ widget, but with the Ok/rename/cancel, its a bit clunky.)

Advertisement

Answer

The --inputmenu option in dialog is the closest fit; anything more would require a custom application. Regarding the “Ok/rename/cancel”, there is some flexibility (see manual page):

--nocancel

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.

--extra-label string

Override the label used for “Extra” buttons. Note: for input-menu widgets, this defaults to “Rename”.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement