Delphi, Override Custom controls setCaption
i have a custom control, with the Ancestor being another custom control, who's Ancestor is a TPanel; i.e.
开发者_开发百科TNotMyCustomControl = class(Tpanel);
TMyCustomControl = class(TNotMyCustomControl);
Is i possible to react when the Caption is being set (run time or design time), and still have the changed passed to the Ancestor controls?
It is possible. Just add a CMTextChanged
message handler to your custom TPanel
:
type
TMyPanel = class(TPanel)
private
procedure CMTextChanged(var Message: TMessage); message CM_TEXTCHANGED;
end;
{ ... }
procedure TMyPanel.CMTextChanged(var Message: TMessage);
begin
inherited;
ShowMessage('caption has been changed');
end;
精彩评论