Hello,
I have an application using SDL2/opengl (let’s try to forget opengl for a moment). I am trying to add scintilla as a text editor. But I have issues with getting events related to the created scintilla control. Relevant code:
(initialization)
HMODULE hmod = LoadLibrary(L"Scintilla.DLL");
hwndScintilla = CreateWindowEx(0,
L"Scintilla", L"", WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN,
10, 10, 500, 400, hwndMain, GetFreeControlID(), GetModuleHandle(NULL), NULL);
(main - before SDL event loop)
SDL_EventState(SDL_SYSWMEVENT, SDL_ENABLE);
(main - SDL event loop)
while (SDL_PollEvent(&ev)) {
if (ev.type == SDL_SYSWMEVENT) {
XEEDITOR::ProcessSysEvents(ev);
}
(...)
(actual event processing)
void ProcessSysEvents(SDL_Event& ev) {
SDL_SysWMmsg* msg = ev.syswm.msg;
if (msg->msg.win.msg == WM_NOTIFY) {
NMHDR* lpnmhdr = (LPNMHDR)msg->msg.win.lParam;
if (lpnmhdr->hwndFrom == hwndScintilla) {
switch (lpnmhdr->code) {
case SCN_CHARADDED:
PLOGD << "Character added";
break;
}
}
}
}
Apparently, lpnmhdr->hwndFrom
never becomes equal to hwndScintilla
.
Any ideas?