Delphi, override custom control setcaption

I have a custom control,
the ancestor is another custom control,
whose ancestor is TPanel;
that is

< p>

TNotMyCustomControl = class(Tpanel);

TMyCustomControl = class(TNotMyCustomControl);

Whether you can react when setting the title (runtime or Design time), and still pass the changes to the Ancestor control?

It’s possible. Just add the CMTextChanged message handler to the 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;

I have a custom control,
The ancestor is another custom control,
Whose ancestor is TPanel;
ie

TNotMyCustomControl = class(Tpanel);

TMyCustomControl = class(TNotMyCustomControl);

Is it possible to react when setting the title (run time or design time) and still pass the changes to the Ancestor control?

It is possible. Just add the CMTextChanged message handler to the custom TPanel:

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

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 3158 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.