1217309Snwhitehorn#! /bin/sh
2217309Snwhitehorn# $Id: mixedform,v 1.6 2010/01/13 10:47:35 tom Exp $
3217309Snwhitehorn
4217309Snwhitehorn. ./setup-vars
5217309Snwhitehorn
6217309Snwhitehornbacktitle="An Example for the use of --mixedform:"
7217309Snwhitehornreturncode=0
8217309Snwhitehornwhile test $returncode != 1 && test $returncode != 250
9217309Snwhitehorndo
10217309Snwhitehornreturncode=$?
11217309Snwhitehornexec 3>&1
12217309Snwhitehornvalue=`$DIALOG  --title "Mixed form demonstration" --ok-label "Submit" \
13217309Snwhitehorn           --backtitle "$backtitle" \
14217309Snwhitehorn	  --insecure "$@" \
15217309Snwhitehorn	  --mixedform "Here is a possible piece of a configuration program." \
16217309Snwhitehorn20 50 0 \
17217309Snwhitehorn	"Username        :" 1 1	"Kiran" 1 20 10 0 2 \
18217309Snwhitehorn	"Password        :"      2 1	""  2 20  8 0 1 \
19217309Snwhitehorn	"Retype Password :"      3 1	""  3 20  8 0 1 \
20217309Snwhitehorn	"HOME            :"     4 1	"Cisco" 4 20 40 0 0 \
21217309Snwhitehorn2>&1 1>&3`
22217309Snwhitehornreturncode=$?
23217309Snwhitehornexec 3>&-
24217309Snwhitehornshow=`echo "$value" |sed -e 's/^/	/'`
25217309Snwhitehorn
26217309Snwhitehorn	case $returncode in
27217309Snwhitehorn	$DIALOG_CANCEL)
28217309Snwhitehorn		"$DIALOG" \
29217309Snwhitehorn		--clear \
30217309Snwhitehorn		--backtitle "$backtitle" \
31217309Snwhitehorn		--yesno "Really quit?" 10 30
32217309Snwhitehorn		case $? in
33217309Snwhitehorn		$DIALOG_OK)
34217309Snwhitehorn			break
35217309Snwhitehorn			;;
36217309Snwhitehorn		$DIALOG_CANCEL)
37217309Snwhitehorn			returncode=99
38217309Snwhitehorn			;;
39217309Snwhitehorn		esac
40217309Snwhitehorn		;;
41217309Snwhitehorn	$DIALOG_OK)
42217309Snwhitehorn		"$DIALOG" \
43217309Snwhitehorn		--clear \
44217309Snwhitehorn		--backtitle "$backtitle" --no-collapse --cr-wrap \
45217309Snwhitehorn		--msgbox "Resulting data:\n\
46217309Snwhitehorn$show" 10 40
47217309Snwhitehorn		;;
48217309Snwhitehorn	$DIALOG_HELP)
49217309Snwhitehorn		echo "Button 2 (Help) pressed."
50217309Snwhitehorn		exit
51217309Snwhitehorn		;;
52217309Snwhitehorn	$DIALOG_EXTRA)
53217309Snwhitehorn		echo "Button 3 (Extra) pressed."
54217309Snwhitehorn		exit
55217309Snwhitehorn		;;
56217309Snwhitehorn	*)
57217309Snwhitehorn		echo "Return code was $returncode"
58217309Snwhitehorn		exit
59217309Snwhitehorn		;;
60217309Snwhitehorn	esac
61217309Snwhitehorndone
62