diff --git a/samples/stc/edit.cpp b/samples/stc/edit.cpp index 8d24658422..d3b4349f08 100644 --- a/samples/stc/edit.cpp +++ b/samples/stc/edit.cpp @@ -112,6 +112,8 @@ BEGIN_EVENT_TABLE (Edit, wxStyledTextCtrl) EVT_STC_MARGINCLICK (wxID_ANY, Edit::OnMarginClick) EVT_STC_CHARADDED (wxID_ANY, Edit::OnCharAdded) EVT_STC_KEY( wxID_ANY , Edit::OnKey ) + + EVT_KEY_DOWN( Edit::OnKeyDown ) END_EVENT_TABLE() Edit::Edit (wxWindow *parent, wxWindowID id, @@ -210,6 +212,22 @@ void Edit::OnKey (wxStyledTextEvent &WXUNUSED(event)) wxMessageBox("OnKey"); } +void Edit::OnKeyDown (wxKeyEvent &event) +{ + if (CallTipActive()) + CallTipCancel(); + if (event.GetKeyCode() == WXK_SPACE && event.ControlDown() && event.ShiftDown()) + { + int pos = GetCurrentPos(); + CallTipSetBackground(*wxYELLOW); + CallTipShow(pos, + "This is a CallTip with multiple lines.\n" + "It is meant to be a context sensitive popup helper for the user."); + return; + } + event.Skip(); +} + void Edit::OnEditCut (wxCommandEvent &WXUNUSED(event)) { if (GetReadOnly() || (GetSelectionEnd()-GetSelectionStart() <= 0)) return; Cut (); diff --git a/samples/stc/edit.h b/samples/stc/edit.h index 7c23268fba..926fe3c8df 100644 --- a/samples/stc/edit.h +++ b/samples/stc/edit.h @@ -103,6 +103,8 @@ public: void OnCharAdded (wxStyledTextEvent &event); void OnKey (wxStyledTextEvent &event); + void OnKeyDown(wxKeyEvent &event); + //! language/lexer wxString DeterminePrefs (const wxString &filename); bool InitializePrefs (const wxString &filename);