Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to apply a vcl style hook to a particular component of a form?

I'm using the vcl style hook of the answer to this question close button of a tabsheet not supporting vcl styles and is working fine, but the close button is draw in all the TPageControl components of my app.

enter image description here

And I want add this option (draw the close button) to only a particular form. The question is : how I can apply this hook or any vcl style hook just to the TPageControl of a specific form?

like image 481
Salvador Avatar asked Sep 12 '25 04:09

Salvador


1 Answers

You can use a interposer class for the TPageControl component

check this sample

type
  TPageControl = class(Vcl.ComCtrls.TPageControl);
  TForm1 = class(TForm)
    PageControl1: TPageControl;
    ...
    ...

And then register the vcl style hook in the same unit where the interposer class is located

  TStyleManager.Engine.RegisterStyleHook(TPageControl, TTabControlStyleHookBtnClose);

Or using a full qualified type name

  TStyleManager.Engine.RegisterStyleHook(Unit1.TPageControl, TTabControlStyleHookBtnClose);
like image 78
RRUZ Avatar answered Sep 14 '25 02:09

RRUZ