This is a desktop problem.
I posted this problem A Window KeyDown event refuses to fire first round then fine and have created a single window with TextAreas and butttons and it still does it. Would someone please look at it to tell me if it fails or doesn’t fail.
The Window’s Keydown event will not fire the first time the keyboard is used instead of the buttons. Why do I think I need to file a Feedback? One reason is it’s as simple of a project as I could get it. Also, at one point the keyboard was unusable for this, and then I cleaned out the cache and it went back to abnormal.
It has nothing to do, actually, with characters. I first thought it had to do with PagePanels, but then I eliminated them. The only unique things are 1 textarea against 2 or it is 3 textareas.
I would like someone to confirm this. I file a lot of reports that are not reproducible.
You might want to restart the computer to clear out the cache (or do it manually). Xojo can get into funny states doing weird things, and a restart usually clears that up for me.
Thanks for confirming. I also restarted my Mac and cleared the cache. It still happened. I know when I run it on my PC, I know it will happen again.
At least now I can say it is not necessarily reproducible.
When you open the app does Next have focus? (might need to turn on a setting to see this on the mac, not 100% sure as I dont have a mac vm running atm to double check)
If you delete PlaySndBttn does the problem stop?
Why is PlaySndBttn at the top of the Tab Order, if you move this to the end of the tab order does the problem stop (even though the control is disabled)
If you add a GotFocus event to every control that just calls system.DebugLog(CurrentMethodName) what do you see in the Message log pane in the IDE?
If you add a Timer to the window (leave its settings as default so it starts 1 second after opening) then add this code to the Action event, what do you see in the Message log pane.
If Self.Focus <> Nil Then
system.DebugLog(Self.Focus.Name + " " + str(Self.Focus.Index))
Else
system.DebugLog("focus=nil")
End If
Edit: Forgot to add, I don’t see the issue in windows 10 on 2021r2
I am working on sleep but some of these I can easily answer.
I have seen this for a few years and just ignored it until I wanted to uhh stare at it.
It’s on PC and Mac. I haven’t tried Linux but will after a couple of days.
The rest can wait
If I have my mac to not show the focus ring for buttons, then the KeyDown event doesn’t fire on the first screen by pressing up/down arrows. If I press Return then up/down arrows fire the KeyDown event.
If I set my mac to show the focus ring for buttons, then the UP button shows the focus ring and KeyDown event fires (up/down arrows) without problems (no need to use Return first).
Thank you Julian. Your questions about focus and TabOrder helped solve the problem.
I moved the buttons to the top of TabOrder and it solved the problem. I didn’t think that would have anything to do with what control had focus. It does. BTW OTButtonSet(3) which is the UP button.
I then added SetFocus to make sure it had focus.
Problem Solved. TabOrder and SetFocus apparently have some thing to do with getting the keyboard to be acfive.
Answers to the questions anyways.
So my new questions are:
If a control isn’t at the top of the TabOrder and the keyboard is expected to fire one of those controls, should it fire?
If no control has Focus, should the keyboard NOT fire?
I’m glad you got it working. Out of interest, re: Alberto’s post above, do you have the focus ring visible in macos or not and re: q1, 2 and 3, could you answer those just for my sanity?
It should, yes. I’ve yet to reproduce the problem in windows so I can’t really say what’s causing it at the moment, I might have to bite the bullet and reinstall my mac vms.
It should, but it will fire on the Window.KeyDown as that will have the focus if no control does.