KeyPress event no longer works - How to troubleshoot?

New to Gambas? Post your questions here. No question is too silly or too simple.
Post Reply
JumpyVB
Newbie
Posts: 96
Joined: Fri Sep 11, 2020 9:09 am

KeyPress event no longer works - How to troubleshoot?

Post by JumpyVB »

The KeyPress event in Gambas no longer works on my PC.

I can recreate the problem like this: File > New project > QT Application or Graphical Application > right click on FMain.form and select Event > KeyPress, and add this code:

Public Sub Form_KeyPress()
  Me.Text = Key.Code
End


And finally when I Run it and try to use the keyboard the KeyPress event doesn't get raised at all.

If I add a TextBox control I am able to input text to it. But even if I add this code Me.Text never changes:

Public Sub TextBox1_KeyPress()
  Me.Text = Key.Code
End


Do you guys have any ideas what I could try next?

PS: I am using Gambas Stable 3.20.2
User avatar
BruceSteers
Legend
Posts: 2193
Joined: Thu Jul 23, 2020 5:20 pm
Location: Isle of Wight

Re: KeyPress event no longer works - How to troubleshoot?

Post by BruceSteers »

It's all working as expected here.

I'm getting KeyPress events from both TextBox and Form


Public Sub TextBox1_KeyPress()

  Debug Key.Code

End

Public Sub Form_KeyPress()

  Debug Key.Code

End
User avatar
thatbruce
Regular
Posts: 314
Joined: Sat Sep 04, 2021 11:29 pm
Location: Sitting at my desk in South Australia

Re: KeyPress event no longer works - How to troubleshoot?

Post by thatbruce »

Explain exactly what you mean by:
And finally when I Run it and try to use the keyboard the KeyPress event doesn't get raised at all.
(I see the same as BruceS)
65_001.png
b
You do not have the required permissions to view the files attached to this post.
Last edited by thatbruce on Fri Apr 04, 2025 1:56 pm, edited 1 time in total.
Online
User avatar
cogier
Site Admin
Posts: 1234
Joined: Wed Sep 21, 2016 2:22 pm
Location: Guernsey, Channel Islands

Re: KeyPress event no longer works - How to troubleshoot?

Post by cogier »

It works OK for me as well.
JumpyVB
Newbie
Posts: 96
Joined: Fri Sep 11, 2020 9:09 am

Re: KeyPress event no longer works - How to troubleshoot?

Post by JumpyVB »

Thank you guys! Your tests encouraged me to install and try the same Gambas test app in another distribution - And I have no issues there :o

The issue is clearly related to the operating system and has appeared at some point after updates of my main OS. Unfortunately the time frame is several months. I cannot pinpoint it better.

I did some further testing with my main OS. I changed the desktop environment from Budgie to Gnome. And found out that KeyPress events are bugged under X.org (both budgie and Gnome), but work fine under the Wayland version of Gnome.

This is clearly an issue I have to discus on the support forum of my main OS.

Thank you.
JumpyVB
Newbie
Posts: 96
Joined: Fri Sep 11, 2020 9:09 am

Re: KeyPress event no longer works - How to troubleshoot?

Post by JumpyVB »

Today I finally found the KeyPress thief: Budgie Window Shuffler Control drag-snap advanced edge-tiling
KeyPressThief.png
As soon as I flip the switch Gambas apps can no longer detect KeyPress event like they should.
And once I disable the switch the remedy is instant and all KeyPress event stat working.
You do not have the required permissions to view the files attached to this post.
Post Reply