Discussion:
wxFileDialog filter index on Mac OS X
Tiron
2011-06-14 23:36:07 UTC
Permalink
The wxFileDialog SetFilterIndex and GetFilterIndex functions don't
work on Mac OS X using wxWidgets 2.9.1. Is there a reason these aren't
supported? There is a comment in src/osx/cocoa/filedlg.mm
wxFileDialog::ShowModal that says:

// since we don't support retrieving the matching filter
m_filterIndex = -1;

Just wondering why this isn't supported, since there are no notes in
the documentation or anything about this. In fact, the documentation
says to set the filter before calling ShowModal, and then ShowModal
looks like it just ignores it anyway.
--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.

To unsubscribe, send email to wx-users+***@googlegroups.com
or visit http://groups.google.com/group/wx-users
Tiron
2011-06-15 00:12:05 UTC
Permalink
Post by Tiron
The wxFileDialog SetFilterIndex and GetFilterIndex functions don't
work on Mac OS X using wxWidgets 2.9.1. Is there a reason these aren't
supported? There is a comment in src/osx/cocoa/filedlg.mm
// since we don't support retrieving the matching filter
m_filterIndex = -1;
Just wondering why this isn't supported, since there are no notes in
the documentation or anything about this. In fact, the documentation
says to set the filter before calling ShowModal, and then ShowModal
looks like it just ignores it anyway.
I'm asking about this because I have 2 filters available (one with my
own extension, and one with a wildcard extension), but it always
defaults to All Files (*.*) no matter what order I put them in. I
don't need to be able to set the filter index specifically, but even
having it default to either the first or last filter would work too.
It makes it save my file with no extension, unless the user
specifically picks my extension.
--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.

To unsubscribe, send email to wx-users+***@googlegroups.com
or visit http://groups.google.com/group/wx-users
Stefan Csomor
2011-06-15 15:55:41 UTC
Permalink
Hi
Post by Tiron
The wxFileDialog SetFilterIndex and GetFilterIndex functions don't
work on Mac OS X using wxWidgets 2.9.1. Is there a reason these aren't
supported? There is a comment in src/osx/cocoa/filedlg.mm
// since we don't support retrieving the matching filter
m_filterIndex = -1;
Just wondering why this isn't supported, since there are no notes in
the documentation or anything about this. In fact, the documentation
says to set the filter before calling ShowModal, and then ShowModal
looks like it just ignores it anyway.
in trunk, it should be supported - please test with that, although for
file opening filters are not visible by default (but respected by
disabling non-matching filenames, as the interface guidelines tell us to
do), only for file saving

if you absolutely need a filter popup for opening you can set

wxSystemOptions::SetOption(wxOSX_FILEDIALOG_ALWAYS_SHOW_TYPES,1);


Best,

Stefan Csomor
--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.

To unsubscribe, send email to wx-users+***@googlegroups.com
or visit http://groups.google.com/group/wx-users
Tiron
2011-06-15 18:08:02 UTC
Permalink
Post by Stefan Csomor
Hi
Post by Tiron
The wxFileDialog SetFilterIndex and GetFilterIndex functions don't
work on Mac OS X using wxWidgets 2.9.1. Is there a reason these aren't
supported? There is a comment in src/osx/cocoa/filedlg.mm
// since we don't support retrieving the matching filter
m_filterIndex = -1;
Just wondering why this isn't supported, since there are no notes in
the documentation or anything about this. In fact, the documentation
says to set the filter before calling ShowModal, and then ShowModal
looks like it just ignores it anyway.
in trunk, it should be supported - please test with that, although for
file opening filters are not visible by default (but respected by
disabling non-matching filenames, as the interface guidelines tell us to
do), only for file saving
if you absolutely need a filter popup for opening you can set
    wxSystemOptions::SetOption(wxOSX_FILEDIALOG_ALWAYS_SHOW_TYPES,1);
Best,
Stefan Csomor
I'm saving a file, so I have the types drop down already. My problem
is that the drop down defaults to the All Files (*.*) type, instead of
my type. So when the user hits Save, my file is saved without an
extension because it was set to All Files. It doesn't seem to make a
difference what I order I put the types in, it always defaults to All
Files.
--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.

To unsubscribe, send email to wx-users+***@googlegroups.com
or visit http://groups.google.com/group/wx-users
Dimitri Schoolwerth
2011-06-16 11:52:05 UTC
Permalink
Post by Tiron
Post by Stefan Csomor
in trunk, it should be supported - please test with that, although for
file opening filters are not visible by default (but respected by
disabling non-matching filenames, as the interface guidelines tell us to
do), only for file saving
if you absolutely need a filter popup for opening you can set
    wxSystemOptions::SetOption(wxOSX_FILEDIALOG_ALWAYS_SHOW_TYPES,1);
I'm saving a file, so I have the types drop down already. My problem
is that the drop down defaults to the All Files (*.*) type, instead of
my type. So when the user hits Save, my file is saved without an
extension because it was set to All Files. It doesn't seem to make a
difference what I order I put the types in, it always defaults to All
Files.
As mentioned there are several improvements in trunk regarding this
(e.g. http://trac.wxwidgets.org/changeset/67550 and 67551). Previously
in 2.9.1 I had the same problem as you did. Have you tried with trunk?


Regards,
Dimitri
--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.

To unsubscribe, send email to wx-users+***@googlegroups.com
or visit http://groups.google.com/group/wx-users
Tiron
2011-06-16 17:22:53 UTC
Permalink
I got it working, thanks.

On Jun 16, 5:52 am, Dimitri Schoolwerth
Post by Dimitri Schoolwerth
Post by Tiron
Post by Stefan Csomor
in trunk, it should be supported - please test with that, although for
file opening filters are not visible by default (but respected by
disabling non-matching filenames, as the interface guidelines tell us to
do), only for file saving
if you absolutely need a filter popup for opening you can set
    wxSystemOptions::SetOption(wxOSX_FILEDIALOG_ALWAYS_SHOW_TYPES,1);
I'm saving a file, so I have the types drop down already. My problem
is that the drop down defaults to the All Files (*.*) type, instead of
my type. So when the user hits Save, my file is saved without an
extension because it was set to All Files. It doesn't seem to make a
difference what I order I put the types in, it always defaults to All
Files.
As mentioned there are several improvements in trunk regarding this
(e.g.http://trac.wxwidgets.org/changeset/67550and 67551). Previously
in 2.9.1 I had the same problem as you did. Have you tried with trunk?
Regards,
Dimitri
--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.

To unsubscribe, send email to wx-users+***@googlegroups.com
or visit http://groups.google.com/group/wx-users
Julian Smart
2014-09-07 15:15:18 UTC
Permalink
Post by Stefan Csomor
Hi
Post by Tiron
The wxFileDialog SetFilterIndex and GetFilterIndex functions don't
work on Mac OS X using wxWidgets 2.9.1. Is there a reason these aren't
supported? There is a comment in src/osx/cocoa/filedlg.mm
// since we don't support retrieving the matching filter
m_filterIndex = -1;
Just wondering why this isn't supported, since there are no notes in
the documentation or anything about this. In fact, the documentation
says to set the filter before calling ShowModal, and then ShowModal
looks like it just ignores it anyway.
in trunk, it should be supported - please test with that, although for
file opening filters are not visible by default (but respected by
disabling non-matching filenames, as the interface guidelines tell us to
do), only for file saving
if you absolutely need a filter popup for opening you can set
wxSystemOptions::SetOption(wxOSX_FILEDIALOG_ALWAYS_SHOW_TYPES,1);
Apologies for reviving a 3-year old thread, but I wonder if I could have
some clarification. I've set the option as above but selecting a filter
in the file dialog UI has no effect on which files are displayed or
enabled (wxOSX/Cocoa, trunk). It always enables all available files, not
the ones matching the current filter, whereas in wxMac/Carbon 2.8, files
not matching the filter were disabled (greyed out). Is there any
particular reason for this change?

It makes choosing files a bit harder because it's not obvious what file
types are pertinent to the current operation. For example, if the user
is importing a file, if all files are enabled it looks as though any
kind of file can be imported. When you have a list of filters, it
becomes a lot more obvious how to use it, but if selecting a filter has
no effect, it looks as though something is broken in the application.

Thanks,

Julian
--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.

To unsubscribe, send email to wx-users+***@googlegroups.com
or visit http://groups.google.com/group/wx-users
Stefan Csomor
2014-09-08 13:53:16 UTC
Permalink
Hi Julian
Post by Julian Smart
Post by Stefan Csomor
wxSystemOptions::SetOption(wxOSX_FILEDIALOG_ALWAYS_SHOW_TYPES,1);
Apologies for reviving a 3-year old thread, but I wonder if I could have
some clarification. I've set the option as above but selecting a filter
in the file dialog UI has no effect on which files are displayed or
enabled (wxOSX/Cocoa, trunk). It always enables all available files, not
the ones matching the current filter, whereas in wxMac/Carbon 2.8, files
not matching the filter were disabled (greyed out). Is there any
particular reason for this change?
It makes choosing files a bit harder because it's not obvious what file
types are pertinent to the current operation. For example, if the user
is importing a file, if all files are enabled it looks as though any
kind of file can be imported. When you have a list of filters, it
becomes a lot more obvious how to use it, but if selecting a filter has
no effect, it looks as though something is broken in the application.
starting from 10.6 I cannot create the filter-popup anymore, this lead to
security violations in several places, therefore I only process the
filter, and enable any file that would be openable by any of these
filters, I¹ve just tested with the dialogs sample and at least that part
of enabling still seems to work.

Best,

Stefan
--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.

To unsubscribe, send email to wx-users+***@googlegroups.com
or visit http://groups.google.com/group/wx-users
Julian Smart
2014-09-08 15:58:56 UTC
Permalink
Hi Stefan,
Post by Stefan Csomor
Hi Julian
Post by Julian Smart
Post by Stefan Csomor
wxSystemOptions::SetOption(wxOSX_FILEDIALOG_ALWAYS_SHOW_TYPES,1);
Apologies for reviving a 3-year old thread, but I wonder if I could have
some clarification. I've set the option as above but selecting a filter
in the file dialog UI has no effect on which files are displayed or
enabled (wxOSX/Cocoa, trunk). It always enables all available files, not
the ones matching the current filter, whereas in wxMac/Carbon 2.8, files
not matching the filter were disabled (greyed out). Is there any
particular reason for this change?
It makes choosing files a bit harder because it's not obvious what file
types are pertinent to the current operation. For example, if the user
is importing a file, if all files are enabled it looks as though any
kind of file can be imported. When you have a list of filters, it
becomes a lot more obvious how to use it, but if selecting a filter has
no effect, it looks as though something is broken in the application.
starting from 10.6 I cannot create the filter-popup anymore, this lead to
security violations in several places, therefore I only process the
filter, and enable any file that would be openable by any of these
filters, I靶e just tested with the dialogs sample and at least that part
of enabling still seems to work.
OK, many thanks - I think Apple have taken a step backwards doing that,
but I guess it's all part of the trend to strip back UI to the basics
(and beyond). I confess I find the Mac OS X file selector a bit limiting
and I miss the ability to type file paths and "..". Maybe it's time to
give users a generic alternative to the native one in my applications.

Regards,

Julian
--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.

To unsubscribe, send email to wx-users+***@googlegroups.com
or visit http://groups.google.com/group/wx-users
Stefan Csomor
2014-09-08 16:39:19 UTC
Permalink
Hi Julian
Post by Julian Smart
Hi Stefan,
Post by Stefan Csomor
Hi Julian
Post by Julian Smart
Post by Stefan Csomor
wxSystemOptions::SetOption(wxOSX_FILEDIALOG_ALWAYS_SHOW_TYPES,1);
Apologies for reviving a 3-year old thread, but I wonder if I could have
some clarification. I've set the option as above but selecting a filter
in the file dialog UI has no effect on which files are displayed or
enabled (wxOSX/Cocoa, trunk). It always enables all available files, not
the ones matching the current filter, whereas in wxMac/Carbon 2.8, files
not matching the filter were disabled (greyed out). Is there any
particular reason for this change?
It makes choosing files a bit harder because it's not obvious what file
types are pertinent to the current operation. For example, if the user
is importing a file, if all files are enabled it looks as though any
kind of file can be imported. When you have a list of filters, it
becomes a lot more obvious how to use it, but if selecting a filter has
no effect, it looks as though something is broken in the application.
starting from 10.6 I cannot create the filter-popup anymore, this lead to
security violations in several places, therefore I only process the
filter, and enable any file that would be openable by any of these
filters, I靶e just tested with the dialogs sample and at least that part
of enabling still seems to work.
OK, many thanks - I think Apple have taken a step backwards doing that,
but I guess it's all part of the trend to strip back UI to the basics
(and beyond). I confess I find the Mac OS X file selector a bit limiting
and I miss the ability to type file paths and "..". Maybe it's time to
give users a generic alternative to the native one in my applications.
there for sure is some kind of native workaround, but I didn’t have the
time to implement it unfortunately ...

shift-command G gives you a file path text entry box from every file open
dialog

Best,

Stefan
--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.

To unsubscribe, send email to wx-users+***@googlegroups.com
or visit http://groups.google.com/group/wx-users
Julian Smart
2014-09-08 18:00:48 UTC
Permalink
Hi Stefan,

Thanks for the Shift+Cmd+G tip! Excellent.

Julian
Post by Stefan Csomor
Hi Julian
Post by Julian Smart
Hi Stefan,
Post by Stefan Csomor
Hi Julian
Post by Julian Smart
Post by Stefan Csomor
wxSystemOptions::SetOption(wxOSX_FILEDIALOG_ALWAYS_SHOW_TYPES,1);
Apologies for reviving a 3-year old thread, but I wonder if I could have
some clarification. I've set the option as above but selecting a filter
in the file dialog UI has no effect on which files are displayed or
enabled (wxOSX/Cocoa, trunk). It always enables all available files, not
the ones matching the current filter, whereas in wxMac/Carbon 2.8, files
not matching the filter were disabled (greyed out). Is there any
particular reason for this change?
It makes choosing files a bit harder because it's not obvious what file
types are pertinent to the current operation. For example, if the user
is importing a file, if all files are enabled it looks as though any
kind of file can be imported. When you have a list of filters, it
becomes a lot more obvious how to use it, but if selecting a filter has
no effect, it looks as though something is broken in the application.
starting from 10.6 I cannot create the filter-popup anymore, this lead to
security violations in several places, therefore I only process the
filter, and enable any file that would be openable by any of these
filters, I靶e just tested with the dialogs sample and at least that part
of enabling still seems to work.
OK, many thanks - I think Apple have taken a step backwards doing that,
but I guess it's all part of the trend to strip back UI to the basics
(and beyond). I confess I find the Mac OS X file selector a bit limiting
and I miss the ability to type file paths and "..". Maybe it's time to
give users a generic alternative to the native one in my applications.
there for sure is some kind of native workaround, but I didn’t have the
time to implement it unfortunately ...
shift-command G gives you a file path text entry box from every file open
dialog
Best,
Stefan
--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.

To unsubscribe, send email to wx-users+***@googlegroups.com
or visit http://groups.google.com/group/wx-users
Loading...