|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
proc RunSample {w} { |
|
|
|
|
|
|
|
|
|
|
|
frame $w.top -border 1 -relief raised |
|
|
|
tixLabelEntry $w.top.ent -label "Select A File:" -labelside top \ |
|
-options { |
|
entry.width 25 |
|
entry.textVariable demo_efdlg_filename |
|
label.anchor w |
|
} |
|
bind [$w.top.ent subwidget entry] <Return> "efdlg:okcmd $w" |
|
|
|
uplevel #0 set demo_efdlg_filename {} |
|
|
|
|
|
button $w.top.btn -text "Browse ..." -command "efdlg:browse" |
|
|
|
pack $w.top.ent -side left -expand yes -fill x -anchor s -padx 4 -pady 4 |
|
pack $w.top.btn -side left -anchor s -padx 4 -pady 4 |
|
|
|
|
|
|
|
tixButtonBox $w.box -orientation horizontal |
|
$w.box add ok -text Ok -underline 0 -command "efdlg:okcmd $w" \ |
|
-width 6 |
|
$w.box add cancel -text Cancel -underline 0 -command "destroy $w" \ |
|
-width 6 |
|
|
|
pack $w.box -side bottom -fill x |
|
pack $w.top -side top -fill both -expand yes |
|
} |
|
|
|
|
|
|
|
proc efdlg:browse {} { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
set dialog [tix filedialog tixExFileSelectDialog] |
|
$dialog config -command efdlg:select_file |
|
|
|
$dialog subwidget fsbox config -filetypes { |
|
{{*} {* -- All files}} |
|
{{*.txt} {*.txt -- Text files}} |
|
{{*.c} {*.c -- C source files}} |
|
} |
|
|
|
wm transient $dialog "" |
|
$dialog popup |
|
} |
|
|
|
proc efdlg:select_file {file} { |
|
global demo_efdlg_filename |
|
|
|
set demo_efdlg_filename $file |
|
} |
|
|
|
proc efdlg:okcmd {w} { |
|
global demo_efdlg_filename |
|
|
|
if {$demo_efdlg_filename != {}} { |
|
tixDemo:Status "You have selected the file $demo_efdlg_filename" |
|
} else { |
|
tixDemo:Status "You haven't selected any file" |
|
} |
|
|
|
destroy $w |
|
} |
|
|
|
|
|
|
|
|
|
if {![info exists tix_demo_running]} { |
|
wm withdraw . |
|
set w .demo |
|
toplevel $w; wm transient $w "" |
|
RunSample $w |
|
bind $w <Destroy> exit |
|
} |
|
|