Author Topic: FileDialog  (Read 4525 times)

Offline coeps

  • Single posting newcomer
  • *
  • Posts: 6
FileDialog
« on: July 15, 2008, 06:12:25 pm »
Hello everybody,

How can i use a wxFileDialog with wxSmith?
I want it to open when a Button "Load" was clicked. When I create a FileDialog I see it as a tool, but how can link it to the Button.


thank you,

coeps

Offline byo

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 837
Re: FileDialog
« Reply #1 on: July 15, 2008, 09:19:09 pm »
In the handler procedure for the button write something like this:

Code: [Select]
void SomeDialog::OnButton1Click(wxCommandEvent& event)
{
    if ( FileDialog1->ShowModal() != wxID_OK ) return;

    wxString FileName = FileDialog1->GetFilename();
    if ( FileName.IsEmpty() ) return;

    // FileName points to selected file
    wxMessageBox( FileName );
}

Regards
   BYO