TK Directory question

Hello,

I am working on a GUI that allows the user to select a file to work on. I am using Tk.getOpenFile to do this. I would like the application to 'remember' the file path from the last time they selected a file, so that the user does not have to browse to the same location over and over. I cannot find any info on how to do this.

Any help would be greatly appreciated. Thanks.

Harry

__________ Information from ESET NOD32 Antivirus, version of virus signature database 4196 (20090629) __________

The message was checked by ESET NOD32 Antivirus.

Hi,
a way is

1) memorize into a var the last directory:

  file = Tk.getOpenFile
  @last_dir = File.dirname(file) if !file.nil?

2) use the option 'initialdir' of Tk.getOpenFile

  file = Tk.getOpenFile('initialdir'=>@last_dir)

Antonio

Harry Truax wrote:

ยทยทยท

Hello,

I am working on a GUI that allows the user to select a file to work on.
I am using Tk.getOpenFile to do this. I would like the application to
'remember' the file path from the last time they selected a file, so
that the user does not have to browse to the same location over and
over. I cannot find any info on how to do this.

Any help would be greatly appreciated. Thanks.

Harry

__________ Information from ESET NOD32 Antivirus, version of virus
signature database 4196 (20090629) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com

--
Posted via http://www.ruby-forum.com/\.