How to see the event result from an EVT_CHAR handler

29 views
Skip to first unread message

Fulvio Senore

unread,
Jun 5, 2024, 12:20:02 PMJun 5
to wx-users
I have an event handler for the EVT_CHAR event. In that event handler I
call event.Skip() to process the event if the char is an allowed one.
Is there a way to see the resulting content of the control after the
char is handled, from inside the same event handler?

If I call GatValue() after Skip() the result is the same as before.

For example, if the user presses the '1' key I would like the content of
the control with the '1' typed by the user.

Thank in advance.

Fulvio Senore

Vadim Zeitlin

unread,
Jun 8, 2024, 10:03:37 AMJun 8
to wx-u...@googlegroups.com
On Wed, 5 Jun 2024 18:19:55 +0200 Fulvio Senore wrote:

FS> I have an event handler for the EVT_CHAR event. In that event handler I
FS> call event.Skip() to process the event if the char is an allowed one.
FS> Is there a way to see the resulting content of the control after the
FS> char is handled, from inside the same event handler?

No.

FS> For example, if the user presses the '1' key I would like the content of
FS> the control with the '1' typed by the user.

The best you can do is to use CallAfter() to execute some code "some time
later".

Regards,
VZ

--
TT-Solutions: wxWidgets consultancy and technical support
https://www.tt-solutions.com/

Fulvio Senore

unread,
Jun 8, 2024, 12:31:33 PMJun 8
to wx-u...@googlegroups.com

Il 08/06/2024 16:03, Vadim Zeitlin ha scritto:
> On Wed, 5 Jun 2024 18:19:55 +0200 Fulvio Senore wrote:
>
> FS> I have an event handler for the EVT_CHAR event. In that event handler I
> FS> call event.Skip() to process the event if the char is an allowed one.
> FS> Is there a way to see the resulting content of the control after the
> FS> char is handled, from inside the same event handler?
>
> No.
>
> FS> For example, if the user presses the '1' key I would like the content of
> FS> the control with the '1' typed by the user.
>
> The best you can do is to use CallAfter() to execute some code "some time
> later".
>
> Regards,
> VZ
>

Thank you for your answer. As usual, when there is no way to do a thing
in a certain way, this means that there are better ways to do it.

After some time I realized that I could use the EVT_TEXT event to solve
my problem.

Fulvio
Reply all
Reply to author
Forward
0 new messages