home *** CD-ROM | disk | FTP | other *** search
- 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
- From: hasty@netcom.com (Amancio Hasty Jr)
- Newsgroups: comp.unix.bsd
- Subject: [386bsd] TK3.0 is available at ref
- Keywords: GUI Builder
- Message-ID: <1993Jan10.174331.6416@netcom.com>
- Date: 10 Jan 93 17:43:31 GMT
- Distribution: comp.unix.bsd
- Organization: Netcom Online Communications Services (408-241-9760 login: guest)
- Lines: 77
-
- I compiled TK3.0 over at ref.tfs.com:/usr/packages/tk.
- The patches and the full binary tree is also available.
-
- TK3.0 distribution now incorporates tcl so it is a one stop shopping :-)
-
- TK is a program that allows non-windows experts to construct X-applications
- with ease. It is an interpreter and has a shell.
-
- To show you how easy it is to build programs, here is a simple
- directory browser from the distribution:
-
- #!/bd/local/wish -f
- #
- # This script generates a directory browser, which lists the working
- # directory and allows you to open files or subdirectories by
- # double-clicking.
-
- # Create a scrollbar on the right side of the main window and a listbox
- # on the left side.
-
- scrollbar .scroll -command ".list yview"
- listbox .list -yscroll ".scroll set" -relief raised -geometry 20x20
- pack append . .scroll {right filly} .list {left expand fill}
-
- # The procedure below is invoked to open a browser on a given file; if the
- # file is a directory then another instance of this program is invoked; if
- # the file is a regular file then the Mx editor is invoked to display
- # the file.
-
- proc browse {dir file} {
- global env
- if {[string compare $dir "."] != 0} {set file $dir/$file}
- if [file isdirectory $file] {
- exec /bd/local/browse $file &
- } else {
- if [file isfile $file] {
- if [info exists env(EDITOR)] {
- eval exec $env(EDITOR) $file &
- } else {
- exec /bd/bin/xedit $file &
- }
- } else {
- puts stdout "\"$file\" isn't a directory or regular file"
- }
- }
- }
-
- # Fill the listbox with a list of all the files in the directory (run
- # the "ls" command to get that information).
-
- if $argc>0 {set dir [lindex $argv 0]} else {set dir "."}
- foreach i [exec ls -a $dir] {
- .list insert end $i
- }
-
- # Set up bindings for the browser.
-
- bind .list <Control-q> {destroy .}
- bind .list <Control-c> {destroy .}
- focus .list
- bind .list <Double-Button-1> {foreach i [selection get] {browse $dir $i}}
-
- ---------------------------------------
-
- Credits:
- karl@NeoSoft.com (Karl Lehenbauer), I used his patches to build tk3.0. tnks!
-
-
- Have fun,
- Amancio
-
-
-
- --
- Amancio Hasty |
- Home: (415) 495-3046 | ftp-site depository of all my work:
- e-mail hasty@netcom.com | sunvis.rtpnc.epa.gov:/pub/386bsd/incoming
-