mixedform revision 217309
10Sstevel@tonic-gate#! /bin/sh
20Sstevel@tonic-gate# $Id: mixedform,v 1.6 2010/01/13 10:47:35 tom Exp $
30Sstevel@tonic-gate
40Sstevel@tonic-gate. ./setup-vars
50Sstevel@tonic-gate
60Sstevel@tonic-gatebacktitle="An Example for the use of --mixedform:"
70Sstevel@tonic-gatereturncode=0
80Sstevel@tonic-gatewhile test $returncode != 1 && test $returncode != 250
90Sstevel@tonic-gatedo
100Sstevel@tonic-gatereturncode=$?
110Sstevel@tonic-gateexec 3>&1
120Sstevel@tonic-gatevalue=`$DIALOG  --title "Mixed form demonstration" --ok-label "Submit" \
130Sstevel@tonic-gate           --backtitle "$backtitle" \
140Sstevel@tonic-gate	  --insecure "$@" \
150Sstevel@tonic-gate	  --mixedform "Here is a possible piece of a configuration program." \
160Sstevel@tonic-gate20 50 0 \
170Sstevel@tonic-gate	"Username        :" 1 1	"Kiran" 1 20 10 0 2 \
180Sstevel@tonic-gate	"Password        :"      2 1	""  2 20  8 0 1 \
190Sstevel@tonic-gate	"Retype Password :"      3 1	""  3 20  8 0 1 \
200Sstevel@tonic-gate	"HOME            :"     4 1	"Cisco" 4 20 40 0 0 \
210Sstevel@tonic-gate2>&1 1>&3`
220Sstevel@tonic-gatereturncode=$?
230Sstevel@tonic-gateexec 3>&-
240Sstevel@tonic-gateshow=`echo "$value" |sed -e 's/^/	/'`
250Sstevel@tonic-gate
260Sstevel@tonic-gate	case $returncode in
270Sstevel@tonic-gate	$DIALOG_CANCEL)
280Sstevel@tonic-gate		"$DIALOG" \
290Sstevel@tonic-gate		--clear \
300Sstevel@tonic-gate		--backtitle "$backtitle" \
310Sstevel@tonic-gate		--yesno "Really quit?" 10 30
320Sstevel@tonic-gate		case $? in
330Sstevel@tonic-gate		$DIALOG_OK)
340Sstevel@tonic-gate			break
350Sstevel@tonic-gate			;;
360Sstevel@tonic-gate		$DIALOG_CANCEL)
370Sstevel@tonic-gate			returncode=99
380Sstevel@tonic-gate			;;
390Sstevel@tonic-gate		esac
400Sstevel@tonic-gate		;;
410Sstevel@tonic-gate	$DIALOG_OK)
420Sstevel@tonic-gate		"$DIALOG" \
430Sstevel@tonic-gate		--clear \
440Sstevel@tonic-gate		--backtitle "$backtitle" --no-collapse --cr-wrap \
450Sstevel@tonic-gate		--msgbox "Resulting data:\n\
460Sstevel@tonic-gate$show" 10 40
470Sstevel@tonic-gate		;;
480Sstevel@tonic-gate	$DIALOG_HELP)
490Sstevel@tonic-gate		echo "Button 2 (Help) pressed."
500Sstevel@tonic-gate		exit
510Sstevel@tonic-gate		;;
520Sstevel@tonic-gate	$DIALOG_EXTRA)
530Sstevel@tonic-gate		echo "Button 3 (Extra) pressed."
540Sstevel@tonic-gate		exit
550Sstevel@tonic-gate		;;
560Sstevel@tonic-gate	*)
570Sstevel@tonic-gate		echo "Return code was $returncode"
580Sstevel@tonic-gate		exit
590Sstevel@tonic-gate		;;
600Sstevel@tonic-gate	esac
610Sstevel@tonic-gatedone
620Sstevel@tonic-gate