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
  •  | 
  •  

سؤال

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?

هل كانت مفيدة؟

المحلول

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.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top