[texworks] SCRIPTING: TWapi getOpenFileName(filter string)
Stefan Löffler
st.loeffler at gmail.com
Sun Dec 12 16:51:08 CET 2010
Hi,
On 2010-12-12 07:01, Paul A Norman wrote:
> Ok, working api usage and documentation for TW.app.getOpenFileName(),
>
> Say I am building a function to insert a graphic name.
>
> http://www.google.com/codesearch/p?hl=en#TCAOwTxChU8/trunk/src/TWApp.cpp&q=getOpenFileName%20package:http://texworks%5C.googlecode%5C.com
>
> ... shows an overload function that can recieve a string that would be
> prepended as a file filter to the Tw standard filter list
>
> Filters in
> http://www.google.com/codesearch/p?hl=en#TCAOwTxChU8/trunk/src/TWUtils.cpp
>
> ... suggests that I can construct my filter to look like this:
> "Image Files (*.jpg *.png *.pdf)"
>
> So then experimentally this works nicely ...
>
> TW.information(null,"Choose Image",TW.app.getOpenFileName("Image
> Files (*.jpg *.png *.pdf)"));
>
> Is my construction for the filter string correct and stable please?
Yes. The filter string is passed to QFileDialog::getOpenFileName, so its
format is documented by Qt (e.g.,
http://doc.trolltech.com/4.3/qfiledialog.html#details)
Note that I would not recommend using ";;" in your string (i.e., to add
more than one filter to the dialog). While this should work in most
cases at the moment, it is not handled properly and may change in the
future.
HTH
Stefan
More information about the texworks
mailing list