Ticket #4793 (closed defect)
Can no longer intercept paste event on wxTextCtrC
|Reported by:||rutgervaneerd||Owned by:|
In wxWidgets 2.8.0 for Windows it was possible to handle wxEVT_COMMAND_TEXT_PASTE for wxTextCtrl BEFORE the default processing (e.g. paste text to the control) was done. This way one could handle pasting manually (e.g. I used it to convert clipboard text to uppercase and write it to the control using WriteText()) and NOT perform the default pasting.
In wxWidgets 2.8.7 this is no longer possible. FIRST default pasting occurs, THEN I receive the wxEVT_COMMAND_TEXT_PASTE event. Because of this it is no longer possible to perform custom pasting (e.g. uppercase conversion, text/numeric conversion, etc.).
I found the following change in msw\textctrl.cpp. In wxWidgets 2.8.0, the WM_PASTE event is handled in wxTextCtrlWndProc. In 2.8.7 the WM_PASTE event is handled in MSWWindowProc.
This means that the WM_PASTE event is first handled by the default Windows handler in wxTextCtrlBase::MSWWindowProc() before wxTextCtrl::MSWWindowProc() can process the event, and generate a wxEVT_COMMAND_TEXT_PASTE event.
I consider this is a bug because a feature is lost (custom pasting). I assume someone tried to clean up message handling and this bug is an unwanted side effect.