You shouldn’t be experiencing re-entrancy in your code. Ie., in normal operations, nothing else should happen until your original KeyDown event finishes, regardless of how many methods you call. Unless you are spawning threads to do the additional methods, but you didn’t mention that.
if an arrow key is pressed several times quickly, for example de PageDown) then, the window shows the first page down, then the second and so on, and no way to stop it until all have finished,
I’d like the PageDown/up/right or left is not executed if there is still the latest one redrawing.
Case kRightArrow
PageLeft()
Case kLeftArrow
PageRight()
Case kUpArrow
PageUp()
Case kDownArrow
PageDown()
What you’re seeing is the system queuing the keypresses and passing them one by one to your app. There’s really no way for you to detect that as your KeyDown event will finish the first one completely before the next one hits your app.
Now that I think about it, I have dealt with this in the past by recording the Microseconds at the end of the event and comparing that at the top of the event and if they happen “too fast”, disregard them.
Theres probably a declare or MBS function you could call to discard any repeated events
Or just empty the apps event queue of all other keyboard &/or mouse events
However, that could have unintended side effects as far as users are concerned