views:

133

answers:

1

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?

+12  A: 

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