User forums > Using Code::Blocks

FileDialog

(1/1)

coeps:
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

byo:
In the handler procedure for the button write something like this:


--- Code: ---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 );
}

--- End code ---

Regards
   BYO

Navigation

[0] Message Index

Go to full version