home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / unix / bsd / 11097 < prev    next >
Encoding:
Internet Message Format  |  1993-01-10  |  2.7 KB

  1. Path: sparky!uunet!convex!news.utdallas.edu!corpgate!bnrgate!bnr.co.uk!uknet!doc.ic.ac.uk!agate!spool.mu.edu!umn.edu!csus.edu!netcom.com!hasty
  2. From: hasty@netcom.com (Amancio Hasty Jr)
  3. Newsgroups: comp.unix.bsd
  4. Subject: [386bsd] TK3.0 is available at ref
  5. Keywords: GUI Builder
  6. Message-ID: <1993Jan10.174331.6416@netcom.com>
  7. Date: 10 Jan 93 17:43:31 GMT
  8. Distribution: comp.unix.bsd
  9. Organization: Netcom Online Communications Services (408-241-9760 login: guest)
  10. Lines: 77
  11.  
  12. I compiled TK3.0 over at ref.tfs.com:/usr/packages/tk.
  13. The patches and the full binary tree is also available.
  14.  
  15. TK3.0 distribution now incorporates tcl so it is a one stop shopping :-)
  16.  
  17. TK is a program that allows non-windows experts to construct X-applications
  18. with ease. It is an interpreter and has a shell.
  19.  
  20. To show you how easy it is to build programs, here is a simple 
  21. directory browser from the distribution:
  22.  
  23. #!/bd/local/wish -f
  24. #
  25. # This script generates a directory browser, which lists the working
  26. # directory and allows you to open files or subdirectories by
  27. # double-clicking.
  28.  
  29. # Create a scrollbar on the right side of the main window and a listbox
  30. # on the left side.
  31.  
  32. scrollbar .scroll -command ".list yview"
  33. listbox .list -yscroll ".scroll set" -relief raised -geometry 20x20
  34. pack append . .scroll {right filly} .list {left expand fill}
  35.  
  36. # The procedure below is invoked to open a browser on a given file;  if the
  37. # file is a directory then another instance of this program is invoked; if
  38. # the file is a regular file then the Mx editor is invoked to display
  39. # the file.
  40.  
  41. proc browse {dir file} {
  42.     global env
  43.     if {[string compare $dir "."] != 0} {set file $dir/$file}
  44.     if [file isdirectory $file] {
  45.         exec /bd/local/browse $file &
  46.     } else {
  47.         if [file isfile $file] {
  48.             if [info exists env(EDITOR)] {
  49.                 eval exec $env(EDITOR) $file &
  50.             } else {
  51.                 exec /bd/bin/xedit $file &
  52.             }
  53.         } else {
  54.             puts stdout "\"$file\" isn't a directory or regular file"
  55.         }
  56.     }
  57. }
  58.  
  59. # Fill the listbox with a list of all the files in the directory (run
  60. # the "ls" command to get that information).
  61.  
  62. if $argc>0 {set dir [lindex $argv 0]} else {set dir "."}
  63. foreach i [exec ls -a $dir] {
  64.     .list insert end $i
  65. }
  66.  
  67. # Set up bindings for the browser.
  68.  
  69. bind .list <Control-q> {destroy .}
  70. bind .list <Control-c> {destroy .}
  71. focus .list
  72. bind .list <Double-Button-1> {foreach i [selection get] {browse $dir $i}}
  73.  
  74. ---------------------------------------
  75.  
  76. Credits:
  77. karl@NeoSoft.com (Karl Lehenbauer), I used his patches to build tk3.0. tnks!
  78.  
  79.  
  80. Have fun,
  81. Amancio
  82.  
  83.  
  84.  
  85. -- 
  86. Amancio Hasty           |  
  87. Home: (415) 495-3046    |  ftp-site depository of all my work:
  88. e-mail hasty@netcom.com    |  sunvis.rtpnc.epa.gov:/pub/386bsd/incoming
  89.