Public Sub Form_KeyPress()
Select Case Key.Text
Case "a" ''lower case A
frmbackground.Workspace1.CloseAll
frmbackground.Workspace1.Add(FrmSignOn, 0)
Case "c" ''lower case C
frmPriceCheck_1.labCallingForm.Text = "frmSignedOff"
frmbackground.Workspace1.CloseAll
frmbackground.Workspace1.Add(frmPriceCheck_1, 0)
Case "e" ''lower case E
frmbackground.Workspace1.CloseAll
frmbackground.Workspace1.Add(frmSignedOffMenu, 0)
End Select
End
[Sloved] Migrating from 3.15 to 3.18 Problems
- cogier
- Site Admin
- Posts: 1127
- Joined: Wednesday 21st September 2016 2:22pm
- Location: Guernsey, Channel Islands
Re: Migrating from 3.15 to 3.18 Problems
This code might help.
-
- Posts: 363
- Joined: Wednesday 2nd December 2020 12:11am
- Location: Northampton, England
- Contact:
Re: Migrating from 3.15 to 3.18 Problems
That's great bud how can I capture the differnt keyboard layout?
Some of them I can program to a,b,c etc but others are like shift F1 etc
That was why I use the key.code is that what seem to be the issue?
Some of them I can program to a,b,c etc but others are like shift F1 etc
That was why I use the key.code is that what seem to be the issue?
- BruceSteers
- Posts: 1581
- Joined: Thursday 23rd July 2020 5:20pm
- Location: Isle of Wight
- Contact:
Re: Migrating from 3.15 to 3.18 Problems
I don't think it's the issue, it's just advice on propper keyboard handling.
for example Shift+F1 should be tested like..
to correctly get key values you should use either a gambas key constant like Key.F1 or from the Key[] array Key["F1"]
if you load a program that tells you Key.Code you will see gtk and qt use very different values. the gambas Key class constants and Key[] array handle that okay.
or there's a Key.Shortcut trick too...
But..
I think the issue is that one is using gtk and the other qt , both toolkits behave differently when it comes to things like key input behaviour.
(assuming you took my earlier advice and stopped using integer values)
a good example.
F1 key code in qt is 16777264
with gtk it's 65470
although Key["A"] is 65 for both toolkits i think you can see why the advice
for example Shift+F1 should be tested like..
If Key.Code = Key.F1 And If Key.Shift
to correctly get key values you should use either a gambas key constant like Key.F1 or from the Key[] array Key["F1"]
if you load a program that tells you Key.Code you will see gtk and qt use very different values. the gambas Key class constants and Key[] array handle that okay.
or there's a Key.Shortcut trick too...
If Key.Shortcut = "Shift+F1"
But..
I think the issue is that one is using gtk and the other qt , both toolkits behave differently when it comes to things like key input behaviour.
(assuming you took my earlier advice and stopped using integer values)
a good example.
F1 key code in qt is 16777264
with gtk it's 65470
although Key["A"] is 65 for both toolkits i think you can see why the advice
If at first you don't succeed , try doing something differently.
BruceS
BruceS
-
- Posts: 363
- Joined: Wednesday 2nd December 2020 12:11am
- Location: Northampton, England
- Contact:
Re: Migrating from 3.15 to 3.18 Problems
I see what you mean but I've noticed on the 3.18.0 version no matter what version got or gtk im using no keyboard input is being handled
I've even done
And I've put a breakpoint on the first one but the breakpoint never kicks in.
I've even done
Public sub form1_keypress
Print key.code
Print key.text
End
And I've put a breakpoint on the first one but the breakpoint never kicks in.
- BruceSteers
- Posts: 1581
- Joined: Thursday 23rd July 2020 5:20pm
- Location: Isle of Wight
- Contact:
Re: Migrating from 3.15 to 3.18 Problems
can you send an example program that has the problem and we can test it on our systems and try to find a fix.AndyGable wrote: ↑Friday 14th July 2023 12:50pm I see what you mean but I've noticed on the 3.18.0 version no matter what version got or gtk im using no keyboard input is being handled
I've even done
Public sub form1_keypress Print key.code Print key.text End
And I've put a breakpoint on the first one but the breakpoint never kicks in.
you might need an observer in the class that has the Form1_Keypress() sub.
Dim hObs As Observer = New Observer(Form1) As "Form1"
It's hard to guess all the possibilities without some test code you know fails on your system.
If at first you don't succeed , try doing something differently.
BruceS
BruceS
-
- Posts: 363
- Joined: Wednesday 2nd December 2020 12:11am
- Location: Northampton, England
- Contact:
Re: Migrating from 3.15 to 3.18 Problems
I fixed itBruceSteers wrote: ↑Thursday 13th July 2023 8:47pmit should be in the same repository
actually is "should" be installed.
maybe
sudo apt install libqt5core5a
or load synaptic package manager and search for qt5 stuff
I installed the QT5 that was not installed when I installed Gambas3 from the backports and now I have installed qt5 it works fine.
so does the 64bit version of Gambas not install the QT5 when it is installed?
- BruceSteers
- Posts: 1581
- Joined: Thursday 23rd July 2020 5:20pm
- Location: Isle of Wight
- Contact:
Re: [Sloved] Migrating from 3.15 to 3.18 Problems
it will install gambas qt5 and gtk3 components if you have the toolkits installed,
no it does not install the toolkits for you it just uses what you have.
glad you sorted it out. (well kind of, now though you know the code only works with qt and not gtk3 so something is not right and working only by luck )
no it does not install the toolkits for you it just uses what you have.
glad you sorted it out. (well kind of, now though you know the code only works with qt and not gtk3 so something is not right and working only by luck )
If at first you don't succeed , try doing something differently.
BruceS
BruceS
-
- Posts: 363
- Joined: Wednesday 2nd December 2020 12:11am
- Location: Northampton, England
- Contact:
Re: [Sloved] Migrating from 3.15 to 3.18 Problems
Could someone tell me i there is any major need to move to 3.18.0?BruceSteers wrote: ↑Friday 14th July 2023 5:52pm it will install gambas qt5 and gtk3 components if you have the toolkits installed,
no it does not install the toolkits for you it just uses what you have.
glad you sorted it out. (well kind of, now though you know the code only works with qt and not gtk3 so something is not right and working only by luck )
- BruceSteers
- Posts: 1581
- Joined: Thursday 23rd July 2020 5:20pm
- Location: Isle of Wight
- Contact:
Re: [Sloved] Migrating from 3.15 to 3.18 Problems
keeping up to date.AndyGable wrote: ↑Friday 14th July 2023 7:45pmCould someone tell me i there is any major need to move to 3.18.0?BruceSteers wrote: ↑Friday 14th July 2023 5:52pm it will install gambas qt5 and gtk3 components if you have the toolkits installed,
no it does not install the toolkits for you it just uses what you have.
glad you sorted it out. (well kind of, now though you know the code only works with qt and not gtk3 so something is not right and working only by luck )
and from 3.15 i'd say yes. there's been many updates since then.
any bug fixes like for what you may have found here will only happen on the latest versions
to be horribly blunt you have to consider that gambas itself runs fine on both qt and gtk so there is probably a more correct way to get your Form_Keypress event (only Benoit i think truly understands how it all works best) and it's just a chance that qt does it your way.
Or possibly it's due to a bug that's now been fixed (the bug letting your code work but was not supposed to).
it'd be interesting to have a small test app you know has this glitch then i could find out what the problem is.
If at first you don't succeed , try doing something differently.
BruceS
BruceS
- BruceSteers
- Posts: 1581
- Joined: Thursday 23rd July 2020 5:20pm
- Location: Isle of Wight
- Contact:
Re: [Sloved] Migrating from 3.15 to 3.18 Problems
3.18.90 (dev branch) is where the real magic happens
If at first you don't succeed , try doing something differently.
BruceS
BruceS