开发者

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;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜