Frequently Asked Component Specific Questions
Options |
Display all FAQ items |
Displaying items 1 to 1 of 1, page 1 of 1
<< previous next >>
TAdvPanel
Using a custom TAdvPanel class to insert panels in a TAdvPanelGroup
Using a custom TAdvPanel class to insert panels in a TAdvPanelGroup
By default, calling AdvPanelGroup.AddPanel will create and insert an instance of TCustomAdvPanel in the AdvPanelGroup. You can override this by setting the class to create via AdvPanelGroup1.PanelClass. Note that the class to be created must descend from TCustomAdvPanel.
Example:
This is a custom created TAdvPanel class that automatically adds a button the panel:
type TMyCustomPanel = class(TAdvPanel) private FButton: TButton; public constructor Create(AOwner: TComponent); override; destructor Destroy; override; property Button: TButton read FButton; end; { TMyCustomPanel } constructor TMyCustomPanel.Create(AOwner: TComponent); begin inherited Create(AOwner); FButton := TButton.Create(Self); FButton.Parent := Self; FButton.Top := 30; FButton.Left := 20; FButton.Caption := ''OK''; end; destructor TMyCustomPanel.Destroy; begin FButton.Free; inherited; end;
begin AdvPanelGroup1.PanelClass := TMyCustomPanel; AdvPanelGroup1.AddPanel; end;