git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@16969
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
void MyFrame::OnDelete(wxCommandEvent&)
{
void MyFrame::OnDelete(wxCommandEvent&)
{
- if ( wxConfigBase::Get()->DeleteAll() )
+ wxConfigBase *pConfig = wxConfigBase::Get();
+ if ( pConfig == NULL )
+ {
+ wxLogError(_T("No config to delete!"));
+ return;
+ }
+
+ if ( pConfig->DeleteAll() )
{
wxLogMessage(_T("Config file/registry key successfully deleted."));
{
wxLogMessage(_T("Config file/registry key successfully deleted."));
- delete wxConfigBase::Set((wxConfigBase *) NULL);
+ delete wxConfigBase::Set(NULL);
wxConfigBase::DontCreateOnDemand();
}
else
wxConfigBase::DontCreateOnDemand();
}
else
- // save the control's values to the config
wxConfigBase *pConfig = wxConfigBase::Get();
if ( pConfig == NULL )
return;
wxConfigBase *pConfig = wxConfigBase::Get();
if ( pConfig == NULL )
return;
+
+ // save the control's values to the config
pConfig->Write("/Controls/Text", m_text->GetValue());
pConfig->Write("/Controls/Check", m_check->GetValue());
pConfig->Write("/Controls/Text", m_text->GetValue());
pConfig->Write("/Controls/Check", m_check->GetValue());
pConfig->Write("/TestValue", wxT("A test value"));
}
pConfig->Write("/TestValue", wxT("A test value"));
}