X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9a83f860948059b0273b5cc6d9e43fadad3ebfca..e0dec8753abaf97e006ea1185bfb6775b28df0a8:/samples/stc/edit.cpp diff --git a/samples/stc/edit.cpp b/samples/stc/edit.cpp index df2fdf1530..17e3737927 100644 --- a/samples/stc/edit.cpp +++ b/samples/stc/edit.cpp @@ -102,6 +102,7 @@ BEGIN_EVENT_TABLE (Edit, wxStyledTextCtrl) // stc EVT_STC_MARGINCLICK (wxID_ANY, Edit::OnMarginClick) EVT_STC_CHARADDED (wxID_ANY, Edit::OnCharAdded) + EVT_STC_KEY( wxID_ANY , Edit::OnKey ) END_EVENT_TABLE() Edit::Edit (wxWindow *parent, wxWindowID id, @@ -119,6 +120,9 @@ Edit::Edit (wxWindow *parent, wxWindowID id, // initialize language m_language = NULL; + // Use all the bits in the style byte as styles, not indicators. + SetStyleBits(8); + // default font for all styles SetViewEOL (g_CommonPrefs.displayEOLEnable); SetIndentationGuides (g_CommonPrefs.indentGuideEnable); @@ -189,6 +193,11 @@ void Edit::OnEditClear (wxCommandEvent &WXUNUSED(event)) { Clear (); } +void Edit::OnKey (wxStyledTextEvent &WXUNUSED(event)) +{ + wxMessageBox("OnKey"); +} + void Edit::OnEditCut (wxCommandEvent &WXUNUSED(event)) { if (GetReadOnly() || (GetSelectionEnd()-GetSelectionStart() <= 0)) return; Cut (); @@ -524,18 +533,6 @@ bool Edit::LoadFile (const wxString &filename) { // load file in edit and clear undo if (!filename.empty()) m_filename = filename; -// wxFile file (m_filename); -// if (!file.IsOpened()) return false; - ClearAll (); -// long lng = file.Length (); -// if (lng > 0) { -// wxString buf; -// wxChar *buff = buf.GetWriteBuf (lng); -// file.Read (buff, lng); -// buf.UngetWriteBuf (); -// InsertText (0, buf); -// } -// file.Close(); wxStyledTextCtrl::LoadFile(m_filename);