[ wxwindows-Bugs-1349304 ] wxFileDialog on FreeBSD

SourceForge.net noreply at sourceforge.net
Thu Nov 22 12:52:15 PST 2007


Bugs item #1349304, was opened at 2005-11-06 02:36
Message generated for change (Comment added) made by wojdyr
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=109863&aid=1349304&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: None
Group: Platform specific
>Status: Closed
>Resolution: Out of Date
Priority: 5
Private: No
Submitted By: wwuster (wwuster)
Assigned to: Nobody/Anonymous (nobody)
Summary: wxFileDialog on FreeBSD

Initial Comment:
Here's a minimal test program that demonstrates this
problem. It works on windows fine. See the comments in
the call to wxFileDialog. Basically, wxFileDialog does
not show the first type of files in the drop down box,
but it will show other files if they are not part of
the first selection.

I don't know what SF.net is. I'll try there too. Can
you tell me where it is?

I'm running FreeBSD 5.4, wxgtk2-2.6.1, xorg.

#ifdef __GNUG__
#pragma implementation
#pragma interface
#endif

#include "wx/wxprec.h"

#ifdef __BORLANDC__
#pragma hdrstop
#endif

#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif

#include "sample.xpm"

#define ID_BUTTON 1
enum  {
        ID_Quit = 1,
        ID_About
};

//-------------------------------------------

class MyApp: public wxApp  {
        virtual bool OnInit();
};

//-------------------------------------------

class MyFrame: public wxFrame  {
        public:
                MyFrame(const wxString &title, const
wxPoint& pos, const wxSize& size);
                ~MyFrame();

                wxButton *button;

                void do_quit(wxCommandEvent& event);
                void do_about(wxCommandEvent& event);
                void do_buttons( wxCommandEvent &event );

                DECLARE_EVENT_TABLE()

        private:
                wxPanel *panel;

};

//-------------------------------------------

MyFrame::~MyFrame() {
}

//-------------------------------------------

BEGIN_EVENT_TABLE(MyFrame, wxFrame)
        EVT_MENU(ID_Quit, MyFrame::do_quit)
        EVT_MENU(ID_About, MyFrame::do_about)
        EVT_BUTTON (ID_BUTTON, MyFrame::do_buttons)
END_EVENT_TABLE()

//-------------------------------------------

bool MyApp::OnInit()  {
        MyFrame *frame = new MyFrame( "wxFileDialog
Test", wxPoint(50,50), wxSize(450,340) );
        frame->Show(TRUE);
        SetTopWindow(frame);
        return TRUE;
}

//-------------------------------------------

MyFrame::MyFrame(const wxString& title, const wxPoint&
pos, const wxSize& size) : wxFrame((wxFrame *)NULL, -1,
title, pos, size)  {

        button = NULL;
        SetIcon(wxICON(sample));

        wxMenu *menuFile = new wxMenu;
        menuFile->Append( ID_About, "&About..." );
        menuFile->AppendSeparator();
        menuFile->Append( ID_Quit, "E&xit" );

        wxMenuBar *menuBar = new wxMenuBar;
        menuBar->Append( menuFile, "&File" );

        SetMenuBar( menuBar );

        panel = new wxPanel(this);

        button = new wxButton(panel, ID_BUTTON,
"&Button", wxPoint(180, 220), wxDefaultSize        );

        panel->SetBackgroundColour(wxColour(0, 0, 80));

}


//-------------------------------------------

void MyFrame::do_quit(wxCommandEvent& WXUNUSED(event))  {
        Close(TRUE);
}

//-------------------------------------------

void MyFrame::do_about(wxCommandEvent& WXUNUSED(event))  {
        wxMessageBox(
                "Test",
                "About",
                wxOK | wxICON_INFORMATION,
                this
        );
}

//-------------------------------------------

void MyFrame::do_buttons( wxCommandEvent &event )  {
        wxString wxstr;

        switch (event.GetId())   {
                case ID_BUTTON:  {
                        wxFileDialog dlg(
                                        this,
                                        _T("Choose a
file"),
               wxEmptyString,
                                        wxEmptyString,
                                        // shows no
.jpg files:
                                        //"JPG files
(*.jpg) | *.jpg",

                                        // no .jpg
files, shows .png files:
                                        "JPG files
(*.jpg)|*.jpg | PNG files (*.png)|*.png",

                                        // shows no
.png files, but shows .jpg files:
                                        //"PNG files
(*.png)|*.png | JPG files (*.jpg)|*.jpg",

                                        wxOPEN |
wxCHANGE_DIR,
                                        wxDefaultPosition
                        );

                        if (dlg.ShowModal() == wxID_OK )  {
                                wxstr = dlg.GetPath();

                        }
                        break;
                }
                default:
                        break;
        }

        return;
}

//-------------------------------------------

IMPLEMENT_APP(MyApp)



----------------------------------------------------------------------

>Comment By: Marcin Wojdyr (wojdyr)
Date: 2007-11-22 21:52

Message:
Logged In: YES 
user_id=586843
Originator: NO

it works for me, on 2.8.4. 
If you still can see this bug, please reopen it.

----------------------------------------------------------------------

Comment By: wwuster (wwuster)
Date: 2005-11-06 14:58

Message:
Logged In: YES 
user_id=1373941


The problem turns out to be white space surrounding the '|'
character.
If you change " | " to "|" it works on FreeBSD. On windows
the whitespace doesn't matter. The behaviour should be
consistent.

Change
(*.png)|*.png | JPG files (*.jpg)|*.jpg",

to
(*.png)|*.png|JPG files (*.jpg)|*.jpg",

William


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=109863&aid=1349304&group_id=9863




More information about the wx-dev mailing list