Hi,
If scintilla does not fire the event, you can workaround it by providing your own event handler and process them before scintilla
do, you just derive a class from wxEvtHandler and add it to the window event handlers.
Here is a simple code that should do what you need (in the following example, I tried to intercept KEY_DOWN, CHAR, CHAR_HOOK, KEY_UP
events):
class MyEvtHandler : public wxEvtHandler
{
public:
void SetWindow(wxWindow *win) { m_win = win; }
MyEvtHandler(wxESFlatMenu *menu, wxEvtHandler* oldHandler)
: m_oldHandler( oldHandler )
{ SetWindow(win); };
virtual bool ProcessEvent(wxEvent& event)
{
if ( event.GetEventType() == wxEVT_KEY_DOWN || event.GetEventType() == wxEVT_KEY_UP ||
event.GetEventType() == wxEVT_CHAR || event.GetEventType() == wxEVT_CHAR_HOOK)
{
// Process the event here (assuming you derived class is called Editor)
Editor* editor = dynamic_cast<Editor*>(m_win);
if( editor )
{
editor->ProcessKeyDown((wxKeyEvent &)event);
}
// And let scintilla keep processing the event
return m_oldHandler->ProcessEvent(event);
}
}
private:
wxWindow *m_win;
wxEvtHandler* m_oldHandler;
};
// in your code, replace the old handler with MyEvtHandler
// Somewhere in the construction of the control put this line:
PushEventHandler(new MyEvtHandler(this, GetEventHandler()) );
// And in the destructor of the control - or in its OnClose function or something similar, add:
PopEventHandler( true ); // Delete the new handler and use the previous one
Hope that helped,
Eran