I've found numerous things in this regard, but they're either for third-party controls, different specific situations, or for a completely different language. What I need should be fairly simple.
I have a TDBGrid with a TComboBox placed over a specific cell. As the user scrolls through this grid, the combo box moves along to the corresponding cell. User is further able to change the value of this combo box to update the database.
However, when using the mouse wheel to scroll, if the mouse pointer just happens to be over this combo box, it ends up changing the value of the combo box, rather than scrolling the grid.
How do I suppress the scrolling in the combo box?
I am answering this QA style, because I found such a simple solution on my own which I couldn't find on various forums.
The simplest method is to add an
OnKeyDownevent handler to theTComboBox, and add the following:Keep in mind that this also blocks keyboard up/down events. If you also wish to block keyboard left/right events, then you can also do this: