[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: TextBox does not trigger KeyPress event with gtk3


Le 29/05/2024 à 16:40, Bruce Steers a écrit :


On Wed, 29 May 2024 at 14:41, Benoît Minisini <benoit.minisini@xxxxxxxxxxxxxxxx <mailto:benoit.minisini@xxxxxxxxxxxxxxxx>> wrote:

    Le 26/05/2024 à 15:21, Bruce Steers a écrit :
     > The following code...
     >
     > Public Sub TextBox1_KeyPress()
     >
     >    Debug Key.Text
     >    If Key.Text Not Like "[0-9]" Then Stop Event
     >
     > End
     >
     > With qt5 if i press text keys the key is printed in the debugger
    and the
     > textbox inputs nothing,
     > and if i press numerical keys they are printed and entered into
    textbox,
     > as expected.
     >
     > gtk3 on the other hand does not fire the TextBox_Keypress event
    at all.
     > all keys are entered into the textbox and the debugger prints
    nothing.
     >
     > So the statement on the wiki,,
     > https://gambaswiki.org/wiki/comp/gb.qt4/control/.keypress
    <https://gambaswiki.org/wiki/comp/gb.qt4/control/.keypress>
     > <https://gambaswiki.org/wiki/comp/gb.qt4/control/.keypress
    <https://gambaswiki.org/wiki/comp/gb.qt4/control/.keypress>>
     >
     >
     >       Event Cancellation
     >
     > If you stop the event with STOP EVENT
     > <https://gambaswiki.org/edit/lang/stopevent
    <https://gambaswiki.org/edit/lang/stopevent>>, the control won't see
    the
     > keyboard event at all.
     >
     > Is only actually true for qt not gtk3
     >
     > Respects
     > BruceS

    Can I have a project that shows the bug? Can you send me your full
    environment with it?

    Thanks.

-- Benoît Minisini.


Well a good example is your own FTestMaskBox.class of comp/gb.form

the MaskBox test form (with QT5) does nothing if you press letter keys but inputs a number at cursor position if you press a number key.
that i think is the expected behavior of the test code.

With GTK3 it just sends the cursor far-left and inputs nothing regardless of pressing either text or number keys. I think this is because the KeyPress event does not trigger with GTK but the Change event does. so the test program does not function as expected.

Respects
BruceS


It's weird, it worked before, and I changed nothing in that code for years.

Anyway, it should be fixed by https://gitlab.com/gambas/gambas/-/commit/b25b3979403c597ed7dd381b29ce334924f16576.

Regards,

--
Benoît Minisini.


References:
TextBox does not trigger KeyPress event with gtk3Bruce Steers <bsteers4@xxxxxxxxx>
Re: TextBox does not trigger KeyPress event with gtk3Benoît Minisini <benoit.minisini@xxxxxxxxxxxxxxxx>
Re: TextBox does not trigger KeyPress event with gtk3Bruce Steers <bsteers4@xxxxxxxxx>