home *** CD-ROM | disk | FTP | other *** search
- #!/bin/vtcl
- # ---------------------------------------------------------------------
- # Copyright 1994 by SCO, Inc.
- # Permission to use, copy, modify, distribute, and sell this software
- # and its documentation for any purpose is hereby granted without fee,
- # provided that the above copyright notice appear in all copies and that
- # both that copyright notice and this permission notice appear in
- # supporting documentation, and that the name of SCO not be used in
- # advertising or publicity pertaining to distribution of the software
- # without specific, written prior permission. SCO makes no
- # representations about the suitability of this software for any
- # purpose. It is provided "as is" without express or implied warranty.
- # ---------------------------------------------------------------------
- # Demo of the use of "VtBeep"
- # - Set the pitch, duration and volume.
- #
- proc DoQuit {cbs} {
- VtClose
- exit 0
- }
-
- proc SetPitch {value cbs} {
- global pitch
- set pitch $value
- }
- proc SetVolume {value cbs} {
- global volume
- set volume $value
- }
- proc SetDuration {value cbs} {
- global duration
- set duration $value
- }
- #
- # Callback that invokes VtBeep with the current values.
- #
- proc beep {cbs} {
- global pitch duration volume
- echo pitch:$pitch duration:$duration volume:$volume
- VtBeep -duration $duration \
- -pitch $pitch \
- -volume $volume
- }
-
- # Open connection to Widget Server
- set app [VtOpen joe]
- set mainF [VtFormDialog $app.mainF -title "beep program"]
-
- # Create radiobox for setting the Pitch value
- #
- set pitchFR [VtFrame $mainF.pitchFR \
- -title "Pitch" \
- -shadowType ETCHED_OUT \
- ]
- set pitchRB [VtRadioBox $pitchFR.pitchRB \
- ]
- VtToggleButton $pitchRB.pitchLow \
- -label Low \
- -callback "SetPitch 100"
- VtToggleButton $pitchRB.pitchMed \
- -label Medium \
- -callback "SetPitch 500" \
- -set 1
- VtToggleButton $pitchRB.pitchHigh \
- -label High \
- -callback "SetPitch 1000"
- set pitch 500
-
- # Create radiobox for setting the volume value
- #
- set volFR [VtFrame $mainF.volFR \
- -title "Volume" \
- -shadowType ETCHED_OUT \
- -leftSide $pitchFR \
- -alignTop $pitchFR \
- ]
- set volRB [VtRadioBox $volFR.volRB \
- ]
- VtToggleButton $volRB.volLow \
- -label Off \
- -xmArgs "XmNforeground red" \
- -callback {SetVolume {-100}}
- VtToggleButton $volRB.volMed \
- -label Normal \
- -callback {SetVolume 50} \
- -set 1
- VtToggleButton $volRB.volHigh \
- -label Loud \
- -callback {SetVolume 100}
- set volume 50
-
- # Create radiobox for setting the duration value
- #
- set durationFR [VtFrame $mainF.durationFR \
- -title "Duration" \
- -shadowType ETCHED_OUT \
- -leftSide $volFR \
- -rightSide FORM \
- -alignTop $volFR \
- ]
- set durationRB [VtRadioBox $durationFR.durationRB \
- ]
- VtToggleButton $durationRB.durationLow \
- -label "Short (.1 sec)" \
- -callback {SetDuration 100}
- VtToggleButton $durationRB.durationMed \
- -label "Normal (.5 sec)" \
- -callback {SetDuration 500} \
- -set 1
- VtToggleButton $durationRB.durationHigh \
- -label "Long (1 sec)" \
- -callback {SetDuration 1000}
- set duration 500
-
- set rc [VtRowColumn $mainF.rc\
- -leftSide FORM \
- -rightSide FORM \
- -topSide $volFR\
- -packing COLUMN\
- -bottomSide FORM\
- -horizontal \
- ]
- set pb [VtPushButton $rc.pb \
- -label "Beep" \
- -callback beep \
- ]
- set quit [VtPushButton $rc.quit \
- -label "Quit" \
- -callback DoQuit \
- ]
-
- VtShow $mainF
- VtMainLoop
-
-