home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 2000 December
/
PCWorld_2000-12_cd.bin
/
Komunikace
/
Comanche
/
gui
/
guiStringFile.tcl
< prev
next >
Wrap
Text File
|
2000-11-02
|
1KB
|
46 lines
class guiStringFile {
inherit guiString
variable button
constructor {frame xuiString} {
guiString::constructor $frame $xuiString
} {
set button [Button $frame.b -image openFolder]
$button configure -command [code $this askFile]
pack $button -side left -padx 3 -anchor w
}
method enable
method disable
method askFile
}
body guiStringFile::askFile {} {
set title [$labelEntry cget -label]
set initialdir [file dirname $value]
if ![file exists $initialdir] {
set initaldir /
}
if [catch {set file [tk_getOpenFile \
-initialdir $initialdir -title $title]}] {
# If we do not have access to the directory (wrong permissions) just open default /
set file [tk_getOpenFile \
-initialdir / -title $title]
}
if [string length $file] {
set value $file
sync
}
}
body guiStringFile::enable {} {
$button configure -state normal
guiString::enable
}
body guiStringFile::disable {} {
$button configure -state disabled
guiString::disable
}