wxFileDialog::SetWildcard() and case sensitivity
Vadim Zeitlin
vadim at wxwidgets.org
Wed Sep 5 09:05:50 PDT 2007
On Wed, 05 Sep 2007 12:34:53 -0300 Ian Britten <britten at caris.com> wrote:
IB> Hey! That seems to work! (I wasn't sure it could, nor the Regex syntax...)
IB>
IB> Something like:
IB> openDialog = new wxFileDialog(
IB> this, _T("Open file"), _T(""), _T(""),
IB> _T("JPG Image (.jpg)|*.[jJ][pP][gG]"),
IB> wxOPEN | wxFILE_MUST_EXIST);
IB> allows me to pick either an upper, lower, or mixed case extension!
IB> [ wxGTK 2.8.4, GTK 2.6.4 ]
IB>
IB> Does anyone know what will happen with this on wxMSW? Will I have to
IB> ifdef the code (Ugh!), or will it work ok (Somehow)?
No, it won't work under MSW.
IB> Note that some of the other comments/replies to this drifted into
IB> discussions about MIME types, default WX behaviour, etc. Although
IB> I appreciate the discussion, I think it drifted off-topic of what I was
IB> looking for.
Not really, unless you're happy with ifdef'ing. If not, we need to find
some reasonable way to extend wx API to allow doing it without ifdefs.
IB> First, my example using JPG was just an example. In my real case, it's
IB> custom files, so I really don't know how (or why) I'd look at the MIME
IB> type stuff. I'm not actually interested in images in this case...
IB> [ Feel free to educate me though, but I'd like to stick with WX code,
IB> not GTK (or MSW) specific stuff... ]
I agree that while using MIME types would be a very useful extension,
sometimes you need to use (case-insensitive) extensions too.
IB> Second, I was not suggesting/requesting that the default behaviour of
IB> WX be changed to handle files/extensions case-insensitively - I don't
IB> think that would be correct...
If it isn't, then we need some way of configuring it. Using a file dialog
flag would indeed work although I don't like it for several reasons: this
is really a propriety of an individual filter and not of the dialog (and so
using a flag wouldn't allow you to have both case-sensitive and insensitive
wildcards, for example).
Personally I like the GTK way: it would be great to have a separate
wxFileWildcard (or wxFileFilter) object which could be constructed either
from extensions or MIME types and have methods for configuring how it
should match. And then we'd pass a "smart" wxFileWildcard and not a dumb
string to wxFileDialog. But, again, unfortunately I don't have time to
implement this idea.
IB> Hmmm... after thinking about this more, I do think some sort of
IB> wxINSENSITIVE_EXTENSION option to the wxFileDialog would be a nice
IB> addition:
IB> - On wxMSW, nothing would need to be done (Insensitive by default)
IB> - On wxGTK, inject the [] characters into the given wildcard pattern
IB> - On wxOSX, ... (Dunno... )
AFAIK OS X is the same as MSW in this respect.
Regards,
VZ
--
TT-Solutions: wxWidgets consultancy and technical support
http://www.tt-solutions.com/
More information about the wx-users
mailing list