Delphi, Override Custom SetCaption Controls

I have user control, with the ancestor being another custom control, who the ancestor is TPanel; i.e.

TNotMyCustomControl = class(Tpanel);

TMyCustomControl    = class(TNotMyCustomControl);

Is it possible to react when Caption is installed (runtime or development time) and there are still changes passed to Ancestor controls?

+3
source share
1 answer

It is possible. Just add a message handler CMTextChangedto 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;
+12
source

Source: https://habr.com/ru/post/1732795/


All Articles