How can I set a new focus when PageDown is pressed?
Posted on 2003-03-13
I've looked for this in the search and got some hints, but not got a solution. I suspect it is pretty simple - I hope so!
I have an application that data entry people Tab through. It consists of small panels with a few checkboxes in each. The Tab button sets the focus from checkbox to checkbox then once it reaches the last checkbox, it sets the focus to the first checkbox in the next panel. This is of course just done through TabOrder.
I'd like the application to set the focus to the first button in the NEXT panel when the PageDown key is pressed. Any ideas?
The panel and checkbox names are dynamically set, so I need a generic solution, though the name of the Checkbox DOES indicate which panel it is in: think of them as CheckBoxP1CB1, CheckBoxP1CB2, CheckBoxP2CB1 etc. where P1CB1 means "panel 1 checkbox 1". The PageDown needs to go to the next increment of P from the one with focus currently set.
The application is already rather top-heavy so I'd like to minimise reading of Windows messages as much as possible.
I've tried ApplicationEvents.OnMessage where msg.message = VK_NEXT but I wasn't able to get it working, and it executed about a hundred times a second!
Quick and simple is ideal.