Skip Menu |

This queue is for tickets about the Wx-Scintilla CPAN distribution.

Report information
The Basics
Id: 79211
Status: open
Priority: 0/
Queue: Wx-Scintilla

People
Owner: ahmad.zawawi [...] gmail.com
Requestors: MUCKER [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.3801
Fixed in: (no value)



Subject: Wx::Eve
The event, Wx::Event::EVT_STC_KEY( $self, -1, \&OnKeyEvent ) (line 53), is not getting detected. I am able to detect other events, but not this one. According to the C++ documentation of WxScintilla, this event must return a WxScintilla::TextEvent object for consumption. It would be great if you can look into it, or maybe I am doing something wrong :)
Apparently the source code of scintilla itself ignores the event. I have created a patch and now the event gets detected. Not sure why such a simple piece of functionality was left out by the scintilla guys :/
Subject: foo.patch
diff -rc Wx-Scintilla-0.3801/wx-scintilla/src/scintilla/src/Editor.cxx Wx-Scintilla-0.3801_mod/wx-scintilla/src/scintilla/src/Editor.cxx *** Wx-Scintilla-0.3801/wx-scintilla/src/scintilla/src/Editor.cxx 2012-03-26 13:55:41.000000000 +0000 --- Wx-Scintilla-0.3801_mod/wx-scintilla/src/scintilla/src/Editor.cxx 2012-08-26 13:17:36.762809170 +0000 *************** *** 4392,4397 **** --- 4392,4409 ---- NotifyParent(scn); } + void Editor::NotifyKey(int ch, bool shift, bool ctrl, bool alt) { + if(ch == 0) { + return; + } + SCNotification scn = {0}; + scn.nmhdr.code = SCN_KEY; + scn.ch = ch; + scn.modifiers = (shift ? SCI_SHIFT : 0) | (ctrl ? SCI_CTRL : 0) | + (alt ? SCI_ALT : 0); + NotifyParent(scn); + } + void Editor::NotifySavePoint(bool isSavePoint) { SCNotification scn = {0}; if (isSavePoint) { *************** *** 5619,5626 **** } int Editor::KeyDown(int key, bool shift, bool ctrl, bool alt, bool *consumed) { ! int modifiers = (shift ? SCI_SHIFT : 0) | (ctrl ? SCI_CTRL : 0) | (alt ? SCI_ALT : 0); return KeyDownWithModifiers(key, modifiers, consumed); } --- 5631,5639 ---- } int Editor::KeyDown(int key, bool shift, bool ctrl, bool alt, bool *consumed) { ! int modifiers = (shift ? SCI_SHIFT : 0) | (ctrl ? SCI_CTRL : 0) | (alt ? SCI_ALT : 0); + NotifyKey(key,shift,ctrl,alt); return KeyDownWithModifiers(key, modifiers, consumed); } diff -rc Wx-Scintilla-0.3801/wx-scintilla/src/scintilla/src/Editor.h Wx-Scintilla-0.3801_mod/wx-scintilla/src/scintilla/src/Editor.h *** Wx-Scintilla-0.3801/wx-scintilla/src/scintilla/src/Editor.h 2012-03-26 13:55:41.000000000 +0000 --- Wx-Scintilla-0.3801_mod/wx-scintilla/src/scintilla/src/Editor.h 2012-08-26 12:43:07.472853855 +0000 *************** *** 429,434 **** --- 429,435 ---- virtual void NotifyParent(SCNotification scn) = 0; virtual void NotifyStyleToNeeded(int endStyleNeeded); void NotifyChar(int ch); + void NotifyKey(int ch, bool shift, bool ctrl, bool alt); void NotifySavePoint(bool isSavePoint); void NotifyModifyAttempt(); virtual void NotifyDoubleClick(Point pt, bool shift, bool ctrl, bool alt);