Is it possible to add custom functionality to a delphi component to be triggered if a specific key is pressed?

StackOverflow https://stackoverflow.com/questions/22875700

  •  28-06-2023
  •  | 
  •  

Question

On my application I have several TDbLookup components and on everyone of them I have to add a procedure that closes and then open again the lookup Query, on the Key Press Event.

So I was wondering:

How can I customize a descendent of TDbLookup component, in order to have a boolean property available on Object Inspector, that I can enable to accomplish this?

If set to true, with focus on the TDbLookup , pressing F5 key, closes and then open the lookup query again.

Is it possible?

Was it helpful?

Solution

Derive a new component from TDbLookup, add your desired property, and then override the virtual KeyPress() method to look at that property and act accordingly.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top