home *** CD-ROM | disk | FTP | other *** search
- # CVS $Id: fsb.tcl,v 1.3 1995/02/03 16:54:47 zibi Exp $
- #
- # Example program for fileselection box
- #
-
- set first_but True
-
- proc quitCB {cbs} {
- VtClose
- exit 0
- }
-
-
- proc okCB {cbs} {
- global rc
-
- #
- # Getting value via callback parameter
- #
- set cb_value [keylget cbs selection]
-
- set wl [split $cb_value "/"]
- set wi [expr "[llength $wl] - 1"]
- set file [lindex $wl $wi]
-
- VtSetValues $rc.file -value $file
- }
-
-
- proc defaultCB {cbs} {
-
- set but [keylget cbs widget]
-
- set fsb1 [VtFileSelectionDialog $but.default \
- -title "Default Fsb" \
- -okCallback okCB]
- VtShow $fsb1
- }
-
- proc labelsCB {cbs} {
- set but [keylget cbs widget]
-
- set fsb2 [VtFileSelectionDialog $but.default \
- -title "Fsb with Button Labels"\
- -filterLabel FILTER_STR_LABEL \
- -fileListLabel FILE_LIST_LABEL \
- -dirListLabel DIR_LIST_LABEL \
- -selectionLabel SELECTION_LABEL\
- -okLabel OK_LABEL \
- -applyLabel FILTER_LABEL \
- -helpLabel HELP_LABEL \
- -cancelLabel CANCEL_LABEL \
- -okCallback okCB]
- VtShow $fsb2
- }
-
- proc hideDirListCB {cbs} {
- set but [keylget cbs widget]
-
- set fsb3 [VtFileSelectionDialog $but.default \
- -title "No Directory List" \
- -hideDirList \
- -okCallback okCB]
- VtShow $fsb3
- }
-
- proc hideDirListAndFilterCB {cbs} {
- set but [keylget cbs widget]
-
- set fsb4 [VtFileSelectionDialog $but.default \
- -title "Files in /etc/default" \
- -filter /etc/default/* \
- -hideFilter \
- -hideDirList \
- -okCallback okCB]
- VtShow $fsb4
- }
-
- proc selectionCB {cbs} {
- set but [keylget cbs widget]
-
- set fsb5 [VtFileSelectionDialog $but.default \
- -title "-selection /etc/default/filesys" \
- -filter /etc/default/* \
- -selection /etc/default/filesys \
- -okCallback okCB]
- VtShow $fsb5
- }
-
- proc cancelCB {cbs} {
- set box [keylget cbs widget]
- VtHide $box
- }
-
- proc autoHideCB {cbs} {
- global first_but
- global fsb6
-
- set but [keylget cbs widget]
-
- if {$first_but == "True"} {
- set fsb6 [VtFileSelectionDialog $but.default \
- -title "-autoHide False w/ cancelCB" \
- -autoHide False \
- -autoDestroy False \
- -cancelCallback cancelCB]
- set first_but False
- }
- VtShow $fsb6
- }
-
-
-
- #
- # Start Program
- #
- #
- set app [VtOpen fsb]
-
- set fn [VtStartForm $app.form -title "Fsb's" ]
-
- set rc [VtRowColumn $fn.rc1]
- VtPushButton $rc.but1 -label "Default fsb" \
- -callback defaultCB
- VtPushButton $rc.but2 -label "Changing Widget Labels" \
- -callback labelsCB
- VtPushButton $rc.but3 -label -hideDirList \
- -callback hideDirListCB
- VtPushButton $rc.but4 -label "-hideDirList and -hideDirFilter "\
- -callback hideDirListAndFilterCB
- VtPushButton $rc.but5 -label -selection \
- -callback selectionCB
- VtPushButton $rc.but6 -label "-autoHide False" \
- -callback autoHideCB
- VtText $rc.file -readOnly
- VtPushButton $rc.but9 -label QUIT \
- -callback quitCB
-
- VtShow $fn
- VtMainLoop
-