home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / tls / tls074c.solsparc.Z / tls074c.solsparc / lib / vtcl / tests / tools.tcl < prev    next >
Encoding:
Text File  |  1995-07-20  |  1.6 KB  |  91 lines

  1. # CVS $Id: tools.tcl,v 1.4 1995/04/28 11:40:41 zibi Exp $
  2. global DisplayTxt
  3.  
  4. #
  5. # Initialize the Display Text area
  6. #
  7. proc InitDisplay {txt} {
  8.      global DisplayTxt
  9.  
  10.      set DisplayTxt $txt
  11. }
  12.  
  13. #
  14. # and sleeps for a delayed number of seconds.
  15. #
  16. proc Display {delay args} {
  17.      global DisplayTxt
  18.  
  19.      VtSetValues $DisplayTxt -value [join $args]
  20.      if {$delay > 0} {sleep $delay}
  21. }
  22.  
  23. #
  24. # Just close the connection
  25. #
  26. proc QuitCB {cbs} {
  27.     VtClose
  28.     exit 0
  29. }
  30.  
  31. #
  32. # This closes the Dialog that the button was in. Actually, it destroys it.
  33. #
  34. proc CloseDialogCB {cbs} {
  35.      set target [keylget cbs widget]
  36.      VtDestroyDialog $target
  37. }
  38.  
  39. #
  40. # Makes a button with label set to label and the callback set
  41. # to cb.
  42. # It returns the reference to the button.
  43. #
  44. proc MakeCenteredButton {name label cb} {
  45.  
  46.     set pb [VtPushButton $name -label $label -callback $cb \
  47.         -labelCenter]
  48.  
  49.     return pb
  50. }
  51.  
  52. #------------------------------------------------------------
  53. #
  54. # This sets the key pair in the dialog's userData field
  55. #
  56. proc SetDialogKey {dlog key data} {
  57.     VxSetVar $dlog $key $data
  58. }
  59.  
  60. #
  61. # does SetDialogKey, but on a cbs
  62. #
  63. proc SetDialogKeyCBS {cbs key data} {
  64.     set dlog [keylget cbs dialog]
  65.     SetDialogKey $dlog $key $data
  66. }
  67.  
  68. #
  69. # This gets the data associated with a key from the dialog's userData field
  70. #
  71. proc GetDialogKey {dlog key} {
  72.     return [VxGetVar $dlog $key]
  73. }
  74.  
  75. proc GetDialogKeyCBS {cbs key} {
  76.     set dlog [keylget cbs dialog]
  77.  
  78.     return [GetDialogKey $dlog $key]
  79. }
  80.  
  81.  
  82. proc CBSGetWidgetShortName {cbs} {
  83.     set w [keylget cbs widget]
  84.     set wl [split $w .]
  85.     set wi [expr "[llength $wl] - 1"]
  86.     set short [lindex $wl $wi]
  87.     return $short
  88. }
  89.  
  90.