void MyFrame::OnSave( wxCommandEvent &event )
{
- if (m_filename.empty())
- OnSaveAs( event );
- else
- m_text->SaveFile( m_filename );
+ Save();
}
void MyFrame::OnSaveAs( wxCommandEvent &event )
bool MyFrame::Save()
{
- m_text->SaveFile();
+ wxCommandEvent event;
+
+ if (m_filename.empty())
+ OnSaveAs( event );
+ else
+ m_text->SaveFile( m_filename );
return TRUE;
}
event.Enable( FALSE );
break;
case ID_DELETE:
+#ifdef __WXUNIVERSAL__
event.Enable( m_text->HasSelection() );
+#else
+ {
+ long selFrom, selTo;
+ m_text->GetSelection(& selFrom, & selTo);
+ event.Enable( selFrom != selTo );
+ }
+#endif
break;
default:
break;