home *** CD-ROM | disk | FTP | other *** search
- ; Form GUI with AWNPipe: by WHMP
- ;This sort of thing is best handled by arexx but this demo is to show how
- ;much can realy be acomplished by an ADOS script using AWNPipe:
-
- ;set up an edit sequence to remove the first line of a file.
- echo >t:editdata "d 1 w"
- resident c:edit add pure
-
- lab start
- ;set defaults
- set 0 "Please Complete this form"
- set 1 ""
- set 2 45
- set 3 5
- set 4 0
-
- lab restart
- ; clear close flag
- set close ""
- ; build the form
-
- echo >t:form.pca "*"CAPipe: Form Demo*" defg v q "
- echo >>t:form.pca "label gt *"$0*" rj"
- echo >>t:form.pca "label ua gt _Name*nString tc gt *"$1*" chl"
- echo >>t:form.pca "label ua gt _Age *ninteger tc minn 5 maxn 111 arrows defn $2 chl"
- echo >>t:form.pca "label ua gt _Computer*nchooser tc pu cl 500|1000|1200|2000|2500|3000|CDTV|4000|other s $3 chl"
- echo >>t:form.pca "label ua gt *"This GUIPipe is*"*nradiobutton tc weih 1 rl *"Cool !|Good|Poor|Realy lame*" s $4 chl"
- echo >>t:form.pca "layout*nButton gt OK c*nbutton gt Cancel c*nbutton gt Reset c*nle*n*n open"
-
- ;display the form and save events in enviroment variable
- type >env:formevent awnpipe:1/xcrt:form.pca
-
- lab loop
- ;read events as env variable into env variable, and again....TRICKS!
-
- ;echo $formevent
- set $formevent
- set $gadget
-
- ;exit if we are done
- if not "$close" eq ""
- skip done
- endif
-
- ;no close yet so delete a line of results and loop to check another event
- edit env:formevent with t:editdata
- skip back loop
-
- lab done
-
- if "$close" eq "6"
- ; we closed with the ok gadget
-
- ;Reopen if name has not been entered
- if "$1" eq ""
- set 0 "Name is a required field"
- skip back restart
- endif
-
- ;show results
- echo "NAME :$1"
- echo "AGE :$2"
- echo "COMPUTER:$3"
- echo "RATING :$4"
-
- endif
- ;else
- ;user closed the window, selected cancel, or selected reset
-
- if "$close" eq "8"
- ;reset was selected
- skip back start
- endif
-
- ;echo "User Aborted"
- ;endif
-
- ;we are done so cleanup
- unset 1
- unset 2
- unset 3
- unset 4
- unset 6
- unset 7
- unset 8
- unset 0
- unset gadget
- resident edit remove
- delete t:form.pca >nil:
- delete env:formevent >nil:
- delete t:editdata >nil:
-
- if "$close" eq "6"
- ; all ok
- unset close
- quit
- endif
-
- ;fail
- unset close
- quit 20
-