home *** CD-ROM | disk | FTP | other *** search
/ PC World 1997 November / PCWorld_1997-11_cd.bin / software / programy / komix / DATA.Z / fchooser.tcl < prev    next >
Text File  |  1996-08-12  |  1KB  |  47 lines

  1. OtkRegister::gui
  2. source [m4_path_name tcl libocl.tcl]
  3. require "wmttool.tcl"
  4. require "messagehdl.tcl"
  5.  
  6.  
  7. proc SelectFile_okPressed {} {
  8.     # --------------------------------------
  9.     # an argument means writting into a file
  10.     # --------------------------------------
  11.     if { "$argv" == "" } {
  12.         puts "[.main.fc selectedSet]"
  13.     } else {
  14.         set fd [open "[lindex $argv 0]" "w"]
  15.         puts $fd "[.main.fc selectedSet]"
  16.         close $fd
  17.     }
  18.     # --------------------------------------------
  19.     # no delete necessary, exit (should) cleans up
  20.     # --------------------------------------------
  21.     exit
  22. }
  23.  
  24. proc SelectFile_cancelPressed {} {
  25.     # --------------------------------------
  26.     # an argument means writting into a file
  27.     # --------------------------------------
  28.     if { "$argv" != "" } {
  29.         set fd [open "[lindex $argv 0]" "w"]
  30.         puts $fd ""
  31.         close $fd
  32.     }
  33.     exit
  34. }
  35.  
  36.  
  37. MainWindow new .main -closed exit
  38. FileChooser new .main.fc \
  39.                 -title "File Chooser" \
  40.                 -directory [pwd] \
  41.                 -okPressed { SelectFile_okPressed } \
  42.                 -cancelPressed { SelectFile_cancelPressed } \
  43.                 -helpPressed { wmtkwarning "No Help Available" } \
  44.                 -selectionPolicy SINGLE \
  45.                 -filter "*.*"
  46. .main.fc popUp
  47.