home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / tls / tls085.solintel.Z / tls085.solintel / lib / vtcl / tests / autolock_msg.tcl < prev    next >
Encoding:
Text File  |  1995-07-20  |  1.7 KB  |  76 lines

  1. # CVS $Id: autolock_msg.tcl,v 1.1 1995/02/03 17:15:08 zibi Exp $
  2. #
  3. # Minimal test of messagebox the idea here is to display all the different
  4. # types at once with different options, like new lines, blank titles, etc.
  5. #
  6.  
  7.  
  8. source tools.tcl
  9.  
  10. proc LabelText {parent label text} {
  11.     VtLabel $parent.label -label $label
  12.     set txt [VtText $parent.txt -value $text -verticalScrollBar  1\
  13.          -rightSide FORM  -rows 3]
  14.  
  15.     return $txt
  16. }
  17.  
  18. proc autoLockCB {cbs} {
  19.     sleep 2
  20.     VtUnLock
  21. }
  22.  
  23. proc mkDlog {cmd buts txt cbs} {
  24.     set txt [VtGetValues $txt -value]
  25.     set parent [keylget cbs widget]
  26.  
  27.     lappend cmd $parent.$cmd -message $txt 
  28.     lappend cmd  -cancel -cancelCallback autoLockCB \
  29.                 -ok -okCallback autoLockCB -autoLock autoLockCB
  30.  
  31.     foreach but $buts {
  32.     if { [VtGetValues $but -value]} {
  33.         set resource [VtGetValues $but -userData]
  34.         lappend cmd $resource
  35.     }
  36.     }
  37.  
  38.     set dialog [eval $cmd]
  39.     VtShow $dialog
  40. }
  41.  
  42. set ap [VtOpen "msg"]
  43.  
  44. set dlog [VtFormDialog $ap.dlog -okLabel Exit -okCallback QuitCB -help]
  45.  
  46. set txt [LabelText $dlog "Message Title" "Default Text"]
  47.  
  48. set rc [VtRowColumn $dlog.rc -leftSide FORM -below $txt -horizontal \
  49.        -CHARM_topOffset 1]
  50.  
  51. foreach but { { OK -ok }  { Cancel -cancel } { Help -help } } {
  52.     set name [lindex $but 0]
  53.     set data [lindex $but 1]
  54.     set b [VtToggleButton $rc.$name -value 1 -userData $data]
  55.     lappend butRay $b
  56. }
  57.  
  58. set dlogs "VtMessageDialog 
  59.        VtErrorDialog 
  60.        VtWarningDialog
  61.        VtInformationDialog
  62.        VtQuestionDialog
  63.        VtWorkingDialog"
  64.  
  65. set rcb [VtRowColumn $dlog.rcb -horizontal -packing COLUMN -numColumns 2\
  66.      -MOTIF_topOffset 10]
  67.  
  68. foreach but $dlogs {
  69.     set b [list $butRay]
  70.     VtPushButton $rcb.$but -callback "mkDlog $but $b $txt"
  71. }
  72.  
  73. VtShowDialog $dlog
  74. VtMainLoop
  75.  
  76.