void OnQuit(wxCommandEvent& event);
void OnAbout(wxCommandEvent& event);
void OnDelete(wxCommandEvent& event);
- bool OnClose() { return TRUE; }
+ void OnCloseWindow(wxCloseEvent& event);
private:
wxTextCtrl *m_text;
EVT_MENU(Minimal_Quit, MyFrame::OnQuit)
EVT_MENU(Minimal_About, MyFrame::OnAbout)
EVT_MENU(Minimal_Delete, MyFrame::OnDelete)
+ EVT_CLOSE(MyFrame::OnCloseWindow)
END_EVENT_TABLE()
// ============================================================================
MyFrame::MyFrame()
: wxFrame((wxFrame *) NULL, -1, "wxConfig Demo")
{
+ // submenu
+ wxMenu *sub_menu = new wxMenu( wxEmptyString, wxMENU_TEAROFF );
+ sub_menu->Append(Minimal_About, "&About", "About this sample");
+ sub_menu->Append(Minimal_About, "&About", "About this sample");
+ sub_menu->Append(Minimal_About, "&About", "About this sample");
+
// menu
wxMenu *file_menu = new wxMenu;
SetClientSize(w, h);
}
+void MyFrame::OnCloseWindow(wxCloseEvent& event)
+{
+ this->Destroy();
+}
+
void MyFrame::OnQuit(wxCommandEvent&)
{
Close(TRUE);
void MyFrame::OnAbout(wxCommandEvent&)
{
- wxMessageBox("wxConfig demo\n© Vadim Zeitlin 1998", "About",
+ wxMessageBox(_T("wxConfig demo\n© Vadim Zeitlin 1998"), _T("About"),
wxICON_INFORMATION | wxOK);
}
void MyFrame::OnDelete(wxCommandEvent&)
{
if ( wxConfigBase::Get()->DeleteAll() ) {
- wxLogMessage("Config file/registry key successfully deleted.");
+ wxLogMessage(_T("Config file/registry key successfully deleted."));
delete wxConfigBase::Set((wxConfigBase *) NULL);
wxConfigBase::DontCreateOnDemand();
}
else
{
- wxLogError("Deleting config file/registry key failed.");
+ wxLogError(_T("Deleting config file/registry key failed."));
}
}