Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

dialog 1

Status
Not open for further replies.

stewang

Programmer
Aug 21, 2003
77
NZ
Hello all:
Do anyone known how to pop up a dialog box for the user to select all and one file from a folder

At the movement, my coding just can pop up a dialog box for the user to select one file from folder.

I am using a linux now, I add the -option with -multiple, but it doesn't do nothing. Would anyone known the option for linux.

Code:
menu .mbar

. configure -menu .mbar

menu .mbar.file -tearoff 0

.mbar add cascade -label "File" -underline 0    -menu .mbar.file

.mbar.file add command -label "Open" -underline 0    -command openFile

proc openFile {} {
 set filename [tk_getOpenFile]     
    set thefile [open $filename r -multiple 1]       
    set filecontent [read $thefile]       
    close $thefile       
}
 
The tk_getOpenFile -multiple option was added in Tcl/Tk 8.4. Note that -multiple is not an option for the open command, just the tk_getOpenFile command. Its use is:

Code:
set fileList [tk_getOpenFile -multiple 1]

You would then need to iterate through the list of file names returned, probably by using a foreach loop.

stewang, do you have a book on Tcl/Tk programming? Many of the questions you ask here you could easily find the answers to with a good Tcl/Tk book. And Tcl's online documentation is a good resource as well. With a quick check of the tk_getOpenFile and open reference pages, you could have discovered the proper use of the -multiple option.

- Ken Jones, President, ken@avia-training.com
Avia Training and Consulting, 866-TCL-HELP (866-825-4357) US Toll free
415-643-8692 Voice
415-643-8697 Fax
 
Hello Avia:
Thanks for your response, I will try it later on.
I have not book on tcl/tk programming, but often I find information from website.

rgds
stewang
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top