[Solved] GTK3 Keyboard

Post your Gambas programming questions here.
Post Reply
AndyGable
Posts: 363
Joined: Wednesday 2nd December 2020 12:11am
Location: Northampton, England
Contact:

[Solved] GTK3 Keyboard

Post by AndyGable »

Hi Everyone,

I hope someone could help me

I have make a small application to test why I can not key any keyboard input on a form with in a workspace

I have discovered the Main Form (FMain) is still holding onto the keyboard

in QT the keyboard input is on the form that is showing in the Workspace

So does anyone know how I can get the Form in the workspace to have the keyboard and NOT the FMain

What should happen is when the app starts you will see in the workspace FrmSignedOff and when you Press A the Form Signed on should show
and when you press B the form FrmSignedOn should close and you will return to FrmSignedOff

Anyone who could help me with this I would be most grateful.
Attachments
KeyboardTestGTK3.7z
This is my test application to see what is happening with the Keyboard input(s)
(15.12 KiB) Downloaded 103 times
Last edited by AndyGable on Friday 22nd December 2023 5:46pm, edited 1 time in total.
AndyGable
Posts: 363
Joined: Wednesday 2nd December 2020 12:11am
Location: Northampton, England
Contact:

Re: GTK3 Keyboard

Post by AndyGable »

update on this issuse

IF i put a textbox on the frmSignedOff and when the screen is loaded I click inside the textbox the form gets focus and the keyboard
works

sooo how do I make the frm get focus

I have tried

Public Sub Form_Open()
  Me.SetFocus
End


but that is not working i have even tired when I load the form at the beginning (with in FMain)

Public Sub Form_Open()
  FMain.Workspace1.Add(frmSignedOff, 0)
  frmSignedOff.SetFocus
End


any recommendations I am open to all idea's
Attachments
KeyboardTestGTK3_0.0.2.7z
(16.82 KiB) Downloaded 106 times
User avatar
BruceSteers
Posts: 1579
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: GTK3 Keyboard

Post by BruceSteers »

maybe you can simply send the logoff form the keypress in FMain_KeyPress.

FMain.class

Public Sub Form_Open()

  FMain.Workspace1.Add(frmSignedOff, 0)

End

Public Sub Form_KeyPress()

  Select Case Key.Code
    Case 65 'Key A
      Me.Text = "Key being captured by FMain"
      frmSignedOff.Form_KeyPress   ' run  frmSignedoff KeyPress event
  End Select

End



you may want to add handling if the application can use either qt or gtk (gb.gui) as they behave differently (as you have found)


Public Sub Form_KeyPress()

  Select Case Key.Code
    Case 65 'Key A
      Me.Text = "Key being captured by FMain"
     If Env["GB_GUI"] Like "gb.gtk*" Then frmSignedOff.Form_KeyPress   ' run  frmSignedoff KeyPress event only if using gtk
  End Select

End
If at first you don't succeed , try doing something differently.
BruceS
AndyGable
Posts: 363
Joined: Wednesday 2nd December 2020 12:11am
Location: Northampton, England
Contact:

Re: GTK3 Keyboard

Post by AndyGable »

That's works perfectly

I've moved to GTK3 as that does seem to be giving me any issues (unlike qt5)
Post Reply