This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
dev:dialog:start [2023/10/25 07:52] – [Dialog] js | dev:dialog:start [2023/10/25 08:15] (current) – [Newt] js | ||
---|---|---|---|
Line 11: | Line 11: | ||
<code bash># | <code bash># | ||
- | + | dialog | |
- | # inputbox - demonstrate the input dialog | + | {{ : |
- | + | ||
- | # Define the dialog exit status codes | + | |
- | : ${DIALOG_OK=0} | + | |
- | : ${DIALOG_CANCEL=1} | + | |
- | : ${DIALOG_HELP=2} | + | |
- | : ${DIALOG_EXTRA=3} | + | |
- | : ${DIALOG_ITEM_HELP=4} | + | |
- | : ${DIALOG_ESC=255} | + | |
- | + | ||
- | # Create a temporary file and make sure it goes away when we're dome | + | |
- | tmp_file=$(tempfile 2>/ | + | |
- | trap "rm -f $tmp_file" | + | |
- | + | ||
- | # Generate the dialog box | + | |
- | dialog --title "INPUT BOX" \ | + | |
- | --clear | + | |
- | --inputbox \ | + | |
- | "Hi, this is an input dialog box. You can use \n | + | |
- | this to ask questions that require the user \n | + | |
- | to input a string as the answer. You can \n | + | |
- | input strings of length longer than the \n | + | |
- | width of the input box, in that case, the \n | + | |
- | input field will be automatically scrolled. \n | + | |
- | You can use BACKSPACE to correct errors. \n\n | + | |
- | Try entering your name below:" | + | |
- | 16 51 2> $tmp_file | + | |
- | + | ||
- | # Get the exit status | + | |
- | return_value=$? | + | |
- | + | ||
- | # Act on it | + | |
- | case $return_value in | + | |
- | $DIALOG_OK) | + | |
- | echo " | + | |
- | $DIALOG_CANCEL) | + | |
- | echo " | + | |
- | $DIALOG_HELP) | + | |
- | echo "Help pressed.";; | + | |
- | $DIALOG_EXTRA) | + | |
- | echo "Extra button pressed.";; | + | |
- | $DIALOG_ITEM_HELP) | + | |
- | echo " | + | |
- | $DIALOG_ESC) | + | |
- | if test -s $tmp_file ; then | + | |
- | cat $tmp_file | + | |
- | else | + | |
- | echo "ESC pressed." | + | |
- | fi | + | |
- | ;; | + | |
- | esac</ | + | |
- | {{ : | + | |
\\ | \\ | ||
\\ | \\ | ||
Line 69: | Line 18: | ||
Newt is a programming library for color text mode, widget based user | Newt is a programming library for color text mode, widget based user | ||
interfaces. | interfaces. | ||
+ | |||
Homepage: [[https:// | Homepage: [[https:// | ||
+ | GitHub: [[https:// | ||
\\ | \\ | ||
\\ | \\ | ||
Line 145: | Line 96: | ||
* [[https:// | * [[https:// | ||
* [[https:// | * [[https:// | ||
- | + | * [[https:// | |
+ | * [[https:// |