We would like to build a community for Small Basic programmers of any age who like to code. Everyone from total beginner to guru is welcome. Click here to register and share your programming journey!


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
GraphicsWindow.LastKey
#8
JR,

Really nice program and I can reproduce your issue.

So first I replaced your return check code with my subroutine and still see the issue.

So then I noticed that the second time Test is called from inside OnButtonClick - this is a non-UI event thread, and Test does struff that should be on the main UI thread, so I updated your code for this and still see the issue!

Next I realised that the TextBox has focus and the Space key is being sent there and the GraphicsWindow.LastKey remains as "Return" since the Space key event didn't get passed to the GraphicsWindow, it just went to the TextBox.  Then I removed the TextBox focus and it worked, but you do need to click inside the textbox to enter a number to it.  It is interesting that GW.LastKey does get the key click in the TextBox (this event bubbles up), but GW does not get the Space key.  Often once an event is handled it then does not progress up the visual tree to a parent element, so the TextBox says I've used the Space key and no need for any other window elements to get this event.

This the code: WMXJ902.000

And here is version where the TextBox focus is set after the Space has been sent to the GW, this also works: WMXJ902.000-0

Fun little puzzle!
[-] The following 1 user Likes litdev's post:
  • jrmrhrb00
Reply


Messages In This Thread
GraphicsWindow.LastKey - by jrmrhrb00 - 01-15-2025, 01:37 PM
RE: GraphicsWindow.LastKey - by litdev - 01-15-2025, 02:09 PM
RE: GraphicsWindow.LastKey - by jrmrhrb00 - 01-15-2025, 02:58 PM
RE: GraphicsWindow.LastKey - by litdev - 01-15-2025, 03:18 PM
RE: GraphicsWindow.LastKey - by jrmrhrb00 - 01-15-2025, 03:58 PM
RE: GraphicsWindow.LastKey - by litdev - 01-15-2025, 05:05 PM
RE: GraphicsWindow.LastKey - by jrmrhrb00 - 01-15-2025, 05:33 PM
RE: GraphicsWindow.LastKey - by litdev - 01-15-2025, 06:47 PM
RE: GraphicsWindow.LastKey - by jrmrhrb00 - 01-15-2025, 07:56 PM
RE: GraphicsWindow.LastKey - by litdev - 01-15-2025, 08:43 PM
RE: GraphicsWindow.LastKey - by AbsoluteBeginner - 01-16-2025, 07:58 AM
RE: GraphicsWindow.LastKey - by litdev - 01-16-2025, 11:59 AM
RE: GraphicsWindow.LastKey - by jrmrhrb00 - 01-16-2025, 02:36 PM
RE: GraphicsWindow.LastKey - by z-s - 01-17-2025, 05:02 PM
RE: GraphicsWindow.LastKey - by litdev - 01-17-2025, 07:24 PM
RE: GraphicsWindow.LastKey - by z-s - 01-18-2025, 10:29 AM
RE: GraphicsWindow.LastKey - by litdev - 01-18-2025, 01:41 PM

Forum Jump:


Users browsing this thread: 6 Guest(s)