void wxStEditApp::OnSTEShellEvent(wxSTEditorEvent& event) { // handle the event and for this example we just write it back wxSTEditorShell* shell = wxDynamicCast(event.GetEventObject(), wxSTEditorShell); wxString val = event.GetString(); shell->AppendText(_("\nText Entered : '") + val + wxT("'\n")); // very simple mechanism to parse the line to do things, you may prefer // using wxPython or wxLua and running the string as is. wxString token(val.BeforeFirst(wxT(' ')).Lower()); if (val.Lower().Strip(wxString::both) == wxT("quit")) { wxCommandEvent quitEvent(wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK); event.SetEventObject(shell); shell->GetEventHandler()->ProcessEvent(quitEvent); } else if (token == wxT("setmaxhistorylines")) { wxString num = val.AfterFirst(wxT(' ')); long n = 0; if (num.ToLong(&n)) { shell->SetMaxHistoryLines(n); shell->AppendText(wxString::Format(_("The maximum number of history lines is set to %d.\n"), n)); } else shell->AppendText(_("ERR: Expected number, eg. SetMaxHistoryLines 10\n")); } else if (token == wxT("setmaxlines")) { wxString num1 = val.AfterFirst(wxT(' ')).Strip(wxString::both); wxString num2 = num1.AfterFirst(wxT(' ')).Strip(wxString::both); num1 = num1.BeforeFirst(wxT(' ')).Strip(wxString::both); long n1 = 0, n2 = 2000; if (num1.ToLong(&n1) && (num2.IsEmpty() || num2.ToLong(&n2))) { shell->SetMaxLines(n1, n2); shell->AppendText(wxString::Format(_("The maximum number of displayed lines is set to\n %d with an overflow of %d lines before deleting up to max lines.\n"), n1, n2)); } else shell->AppendText(_("ERR: Expected number, eg. SetMaxLines 10 [2000]\n")); } shell->CheckPrompt(true); }