Re: Handling wxKeyEvent in another wxStyledTextCtrl

Vadim Zeitlin <[email protected]>
Newsgroups gmane.comp.lib.wxwindows.general
Message-ID <[email protected]>
On Thu, 27 Jul 2023 12:36:12 -0700 (PDT) Eran Ifrah wrote:

EI> I have a small question:
EI> I have a custom control which consists of 2 wxStyledTextCtrl (laid out 
EI> vertically)
EI> 
EI> My end goal: when a user types a character inside the top wxStyledTextCtrl, 
EI> I want it to be processed by the bottom wxStyledTextCtrl.

 There is unfortunately no way to make it work reliably on all platforms
right now. It would be nice to have one.

EI> Can this be achieved?
EI> (I tried various solutions, none seemed to work. For example: bind 
EI> wxEVT_CHAR_HOOK and in the top wxSTC and then setting the focus to the 
EI> bottom followed by calling `ProcessEvent` in the lower wxSTC

 This can't work because wxSTC, not being fundamentally implemented in wx,
has no idea about what to do with wx events. The events need to be
forwarded at lower level. wxUIActionSimulator does work at lower level, but
it doesn't really forward anything but synthesizes new events, which is not
100% reliable. And, of course, wxUIActionSimulator doesn't work at all in
wxGTK when using Wayland currently (and has problems under Mac too).

 Doing this correctly would require some platform-specific code. Under MSW
it should be simple enough to just forward all WM_KEYXXX events, but I'm
less sure about the other platforms.

 Regards,
VZ

-- 
TT-Solutions: wxWidgets consultancy and technical support
              https://www.tt-solutions.com/
signature.asc (application/pgp-signature, 195 B)
-----BEGIN PGP SIGNATURE-----

iF0EABECAB0WIQQx+vLQdOwioQqkxtoG6kHeT2wehgUCZMLoAgAKCRAG6kHeT2we
hqRSAKCPWRrtkBDqQWYaV51x5FxVTY+x7QCfQr2chLAX/AvY0DhqPthbdqQFUrc=
=WqOH
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.