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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

tk_getOpenFile question

Status
Not open for further replies.

haoose

Technical User
Dec 22, 2003
15
US
Hi all,

I was wondering if anyone has encountered the following situation using "tk_getOpenFile" dialog box:

I have been using Prowish 8.0 with my application and I have used the following command to open files:
set file_selected [ file nativename [ tk_getOpenFile \
-title $win_title \
-filetypes $file_type ] ]
This command has made it possible to close my application and open it again, and then select a file while "remembering" the directory where I grabbed the last file from.

When I switched to ActiveTcl 8.4 I relaized I had to use the following command to "remember" the directory where my files were:
# remember the previously chosen directory
if {$file_selected != ""} {
set dir_selected [file dirname $file_selected]
} else {
set dir_selected [pwd]; # no directory in memory
}
set file_selected [ file nativename [ tk_getOpenFile \
-title $win_title \
-filetypes $file_type \
-initialdir $dir_selected ]]
This works for me as long as I don't close my application. When I close my application I have to search through my directories to find the directory with the files. This is very tedious especially when my files are located 5 to 6 subdirectories away.

Does anyone know why this is happening? Or why the directory is "remembered" in Prowish 8.0 versus ActiveTcl 8.4?

TIA
 
I don't know anything about Prowish. I never knew there was any way to remember variables across executions.

_________________
Bob Rashkin
 
What if you tried dumping the name of the directory selected into a file somewhere, like C:\Temp or someplace, then the next time you fire off your program check if that file exists and grab the value from it
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top