Logo QF-Test

Finding valuable answers
in the Mailing List Archive.


Free Trial  Download  Buy

Thomas Max, QF-Test training and support

Use the full-text search on our web site to find helpful tips on the mailing list.

Thomas Max, 
Sr. Software Engineer & Trainer, QFS

2017 up to now  | 2016 | 2015 | 2014 | 2013 | 2012 | 2011 | 2010 | 2009 | 2008 | 2007

(older archive entries before 2007 are not shown here, but included in the onsite-search)

Mailing List - Entries of 2013

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [QF-Test] Select multiple files in filechooser

  • Subject: Re: [QF-Test] Select multiple files in filechooser
  • From: Gregor Schmid <Gregor.Schmid@?.de>
  • Date: Thu, 02 May 2013 20:56:52 +0200

Hello Gonzalo,

yes, it is possible to select multiple files with this procedure,
though it's neither documented nor obvious. In fact, I had to
experiment a little to find out how to do it.

In short, if a JFileChooser has multi selection enabled, it lists the
selected files as a blank-separated list of quoted filenames in the
file name field. As with single selection it is possible to simply set
the text-field to the select file(s) and click OK, which is what the
selectFile procedure does. So, if you call selectFile with the
parameter file set to

"/tmp/foo" "/tmp/bar"

the result should be a selection of those two files.

Getting the parameter into the selected format can be done with a bit
of scripting. If you've got the files as a comma-separated list, for
example, the following script should help

files = rc.lookup("files").split(",")
# Now files is the list of filenames once you've got those, the
# following statement will create the required string
files = " ".join(['"%s"' % f.strip() for f in files])
rc.callProcedure("qfs.swing.filechooser.selectFile", {"file": files})

I think we'll add a selectFiles procedure to our standard library.

Best regards,

Gonzalo Parra <gonzalo.parra@?.com> writes:

> Hello,
> I'm using the filechooser utility package included in the standard library and I have a question:
> Is it possible to select multiple files using this utility? How can I do it?
> Is there any workaround to this?
> Thank you very much.
> Best Regards
> _______________________________________________
> qftest-list mailing list
> qftest-list@?.de
> http://www.qfs.de/mailman/listinfo/qftest-list

Gregor Schmid                                Gregor.Schmid@?.de
Quality First Software GmbH                     http://www.qfs.de
Tulpenstr. 41                               Tel: +49 8171 38648-0
DE-82538 Geretsried                         Fax: +49 8171 3864816
GF: Gregor Schmid, Karlheinz Kellerer          HRB München 140833

Videos Downloads Documentation Buy Free Trial