[ wxwindows-Bugs-1524065 ] Problems with
wxFileDialog::GetFilterIndex()
SourceForge.net
noreply at sourceforge.net
Mon Jul 17 12:16:49 PDT 2006
Bugs item #1524065, was opened at 2006-07-17 19:16
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=109863&aid=1524065&group_id=9863
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: wxGTK specific
Group: Must fix
Status: Open
Resolution: None
Priority: 5
Submitted By: Alex Bligh (abligh)
Assigned to: Nobody/Anonymous (nobody)
Summary: Problems with wxFileDialog::GetFilterIndex()
Initial Comment:
wxFileDialog seems to operate under the mistaken
assumption that it is only possible to select files
matching the filters.
If a wxFileDialog is opened with a list of filters
under GTK, then you type in the full name of a filename
(e.g. "/home/amb/my.xyz", and my.xyz matches no filter
on the list, GTK selects a filter with index of -1.
The relevant line filedlg.cpp line 516 (on 2.6 HEAD):
wxFAIL_MSG( wxT("wxFileDialog::GetFilterIndex - bad
filter index returned by gtk+") );
If, subsequent to OK being pressed,
wxFileDialog::GetFilterIndex is called, this produces
an assert, and returns 0. The assert however cannot be
avoided, as it is not possible to detect this
situation. Neither can the return value of 0 be
distinguished from the first filter being selected.
I think the best thing to do here would be to grey out
the OK button under such circumstances, so the file
(which doesn't match any filter) cannot be selected in
the first place.
If this isn't done, I think it's going to be necessary
to return some form of error condition (e.g. -1)
without doing the asser.
Alex
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=109863&aid=1524065&group_id=9863
More information about the wx-dev
mailing list