mirror of
https://github.com/wxWidgets/wxWidgets.git
synced 2026-09-26 09:56:32 +08:00
Add event generation to MSW IFileDialog-based implementation
Inherit wxFileDialogCustomControl from wxEvtHandler to allow Bind()ing to events on it and use this to handle wxEVT_BUTTON and wxEVT_CHECKBOX in the sample. And inherit from IFileDialogControlEvents in wxMSW code to actually generate these events when they happen.
This commit is contained in:
@@ -1694,7 +1694,9 @@ public:
|
||||
customizer.AddStaticText("Just some extra text:");
|
||||
m_text = customizer.AddTextCtrl();
|
||||
m_cb = customizer.AddCheckBox("Enable Custom Button");
|
||||
m_cb->Bind(wxEVT_CHECKBOX, &MyCustomizeHook::OnCheckBox, this);
|
||||
m_btn = customizer.AddButton("Custom Button");
|
||||
m_btn->Bind(wxEVT_BUTTON, &MyCustomizeHook::OnButton, this);
|
||||
m_label = customizer.AddStaticText("Nothing selected");
|
||||
}
|
||||
|
||||
@@ -1721,6 +1723,17 @@ public:
|
||||
wxString GetInfo() const { return m_info; }
|
||||
|
||||
private:
|
||||
void OnCheckBox(wxCommandEvent& event)
|
||||
{
|
||||
m_btn->Enable(event.IsChecked());
|
||||
}
|
||||
|
||||
void OnButton(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxMessageBox("Custom button pressed", "wxWidgets dialogs sample",
|
||||
wxOK | wxICON_INFORMATION, m_dialog);
|
||||
}
|
||||
|
||||
wxFileDialog* const m_dialog;
|
||||
|
||||
wxFileDialogButton* m_btn;
|
||||
|
||||
Reference in New Issue
Block a user