Hello,
I'm writing a C++ plugin for AkelPad 4.9.9 (Unicode).
The plugin needs to work live, i.e. it should be notified whenever the document changes:
typing a character,
Backspace/Delete,
Paste,
Undo/Redo.
The goal is to rebuild an internal word list immediately after the text changes.
I already have:
access to PLUGINDATA,
the AkelEditW window handle,
successful WM_GETTEXT (I can read the whole document correctly),
a working DLL loaded by AkelPad.
I first tried subclassing AkelEditW with SetWindowLongPtr(GWLP_WNDPROC, ...), but that caused instability, so I don't think this is the correct approach.
Then I found the SDK example for:
AKD_SETMAINPROCRET
with:
WNDPROCRETDATA *wprd = NULL;
void CALLBACK NewMainProcRet(CWPRETSTRUCT *cwprs)
{
if (cwprs->message == WM_NOTIFY)
{
...
}
if (wprd->NextProc)
wprd->NextProc(cwprs);
}
However, I don't know which notification is generated when the document text changes.
My questions are:
What is the recommended way for a plugin to detect every text modification in AkelPad?
Should I use AKD_SETMAINPROCRET, AKD_SETEDITPROCRET, or something else?
Which notification/message is generated after:
typing,
deleting,
pasting,
undo/redo?
Is there an AEN_* notification or another event intended specifically for text changes?
I would appreciate a small example of the recommended solution.
Thank you!
How to receive live text change notifications in an AkelPad plugin?
- Author
- Message
-
Offline
- Posts: 293
- Joined: Thu Sep 10, 2015 9:53 am
- Location: Deutschland
-
Offline
- Posts: 1347
- Joined: Thu Nov 16, 2006 11:53 am
- Location: Kyiv, Ukraine
Re: How to receive live text change notifications in an AkelPad plugin?
AEN_TEXTCHANGED and AEN_TEXTCHANGING are the way.
Example:
https://github.com/d0vgan/AkelPad-Plugs ... in.c#L1259
https://github.com/d0vgan/AkelPad-Smart ... h.bas#L545
More details:
https://github.com/d0vgan/AkelPad-Plugs ... it.h#L2303
https://github.com/d0vgan/AkelPad-Plugs ... it.h#L1574
Example:
https://github.com/d0vgan/AkelPad-Plugs ... in.c#L1259
https://github.com/d0vgan/AkelPad-Smart ... h.bas#L545
More details:
https://github.com/d0vgan/AkelPad-Plugs ... it.h#L2303
https://github.com/d0vgan/AkelPad-Plugs ... it.h#L1574
-
Offline
- Posts: 293
- Joined: Thu Sep 10, 2015 9:53 am
- Location: Deutschland