home *** CD-ROM | disk | FTP | other *** search
- # CVS $Id: baseline.tcl,v 1.1 1995/02/03 17:15:11 zibi Exp $
- #@(#) baseline.tcl 11.4 95/01/31
- # This tests VtGetValues on the following options.
- # -baseLineList
- # -width
- # -height
- #
-
-
- proc QuitCB { cbs } {
- VtClose
- }
-
- proc TestCB {junk} {
- global txt
-
- set str [ VtGetValues $txt -value ]
-
- if { [ VtInfo -charm ] } {
- set OKstr "Text baseLineList is <0>\n width - <42> height <4>\nLabel baseLineList is <0>\n width - <8> height <1>"
- VtClose
- if { ! [string compare $str $OKstr ]} \
- { puts PASS } else { puts FAILED }
- exit 0
- } \
- else \
- {
- # set OKstr "Text baseLineList is <20 33 46 59>\n width - <240> height <52>\nLabel baseLineList is <13>\n width - <52> height <14>"
-
- set OKstr "Text baseLineList is <21 36 51 66>\n width - <360> height <60>\nLabel baseLineList is <15>\n width - <63> height <16>"
- if { ! [string compare $str $OKstr ]} \
- { puts PASS } else { puts FAILED }
- echo $OKstr
-
- VtClose
- }
-
- }
-
-
- set ap [VtOpen geometry]
-
- set dlog [VtFormDialog $ap.form ]
-
- set label [VtLabel $dlog.lbl -label "Address:"]
- set txt [VtText $dlog.txt -rows 4 -columns 40 \
- -leftSide $label -topSide FORM]
-
- VtPushButton $dlog.t -label "Test" -callback TestCB
-
- VtSeparator $dlog.s -leftSide FORM -rightSide FORM
- VtPushButton $dlog.q -label "Quit" -callback QuitCB \
- -bottomSide FORM \
- -leftSide 40 \
- -rightSide 60
-
-
- set baseLineList [VtGetValues $txt -baseLineList]
- set width [VtGetValues $txt -width]
- set height [VtGetValues $txt -height]
-
- set txtBaseLine [lindex $baseLineList 0]
-
- set str "Text baseLineList is <$baseLineList>"
- set str "$str\n width - <$width> height <$height>"
-
- VtShow $dlog
-
-
- set baseLineList [VtGetValues $label -baseLineList]
- set width [VtGetValues $label -width]
- set height [VtGetValues $label -height]
-
- set str "$str\nLabel baseLineList is <$baseLineList>"
- set str "$str\n width - <$width> height <$height>"
- VtSetValues $txt -value $str
-
- set lblBaseLine [lindex $baseLineList 0]
-
- if {$txtBaseLine > $lblBaseLine} {
- set diff [expr $txtBaseLine - $lblBaseLine]
-
- VtSetValues $txt -topOffset 4
- VtSetValues $label -topOffset [expr 4 + $diff]
- } else {
- set diff [expr $lblBaseLine - $txtBaseLine]
-
- VtSetValues $label -topOffset 4
- VtSetValues $txt -topOffset [expr 4 + $diff]
- }
-
- #
-
- # baselines don't work in charm
- if {[VtInfo -charm]} {
- VtSetValues $label -topOffset 1
- VtSetValues $txt -topOffset 0
-
-
- }
-
- # UnComment this for automatic behaviour
- #VtAddTimeOut -interval 2000 -callback TestCB
-
- VtMainLoop
-