I know if I inherite from TCustomAction to write a TMyAction, I can override
TCustomAction.HandlesTarget/UpdateTarget method to get this ability. But the
component I want to write is TCustomComboBox, I do not know how to do.
I have read the code about TBasicAction, TContainedAction, TCustomAction,
but I am so foolish and do not know why TAction have this ability.
Could you help me? Thank you very much!
If I understand you correctly, you want to create a new component, that
changes its Enabled property depending on if the active control of the form
is a TCustomEdit or not, sort of run code like this:
Self.Enabled := (Parent as TForm).ActiveControl is TCustomEdit;
and the problem is (probably) that you don't know how to get this code to
run at the correct places.
One solution I've used is to use an TApplicationEvents component
internally, and use the OnIdle event handler of that component to be
notified when the program is entering idle state.
--
Lasse Vågsæther Karlsen
PGP KeyID: 0x0270466B
I find another way to do this. As you know, TControl have a property --
Action. I use this Action to solve my question.
If you create an action object internally, and use its OnUpdate event
handler you are in fact using the same system :)