rectControl.keydown doesn't fire when a modifier key is pressed

I need to capture if just the control key is pressed in a Canvas, but keyDown doesn’t fire unless a normal is also pressed. Am I missing something?

I believe that’s the expected behavior, and, IIRC, the workaround is to use a timer when the Canvas has focus.

That’s too bad.

I quickly put this together. Hopefully it helps.

https://www.dropbox.com/s/vunpva6fp0h7w4g/modifierkeycanvas.xojo_binary_project?dl=1

Thanks, I’m investigating ways without using Timers.

1 Like

I hope you report back with your findings. I used to have some Windows-specific declares for this, but who knows where they are now, and I don’t think I fleshed it out for other OSes as I didn’t need it in those projects.

I have something working, but it is not a simple declare I can just share. I will include an example in the next App Kit 2021 - Building Better Mac Applications update.

I still need to work out some things so I can use it to make my custom control meet the Apple HIG.

2 Likes
Forum for Xojo Programming Language and IDE. Copyright © 2021 Xojo, Inc.