Hi All,
Can someone help me. I am trying to create a number of Panels inside a scrollbox. Between each panel i need a splitter. I have written following code to achieve this.
When i run this code all the splitters are displayed at the top of the ScrollBox. I would like each splitter to be in between two panels created.
Could someone tell me what am i doing wrong?
Thank you very much in advance
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics,Controls, Forms, Dialogs, ExtCtrls;
type
TForm1 = class(TForm)
ScrollBox1: TScrollBox;
procedure FormCreate(Sender: TObject);
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
var
panel:TPanel;
splitter:TSplitter;
x,i:integer;
begin
x:=10;
//Create x number of panels inside ScrollBox1 aligned on top
for i:=1 to x do
begin
//Create the panel and align it on top
panel:=TPanel.Create(ScrollBox1);
panel.Parent:=ScrollBox1;
panel.Align:=alTop;
//Add a splitter and align it on top (below the panel just created???)
splitter:=TSplitter.Create(ScrollBox1);
splitter.Parent:=ScrollBox1;
splitter.Align:=alTop;
end;
//Add one final panel aligned as client
panel:=TPanel.Create(ScrollBox1);
panel.Align:=alClient;
end;
Can someone help me. I am trying to create a number of Panels inside a scrollbox. Between each panel i need a splitter. I have written following code to achieve this.
When i run this code all the splitters are displayed at the top of the ScrollBox. I would like each splitter to be in between two panels created.
Could someone tell me what am i doing wrong?
Thank you very much in advance
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics,Controls, Forms, Dialogs, ExtCtrls;
type
TForm1 = class(TForm)
ScrollBox1: TScrollBox;
procedure FormCreate(Sender: TObject);
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
var
panel:TPanel;
splitter:TSplitter;
x,i:integer;
begin
x:=10;
//Create x number of panels inside ScrollBox1 aligned on top
for i:=1 to x do
begin
//Create the panel and align it on top
panel:=TPanel.Create(ScrollBox1);
panel.Parent:=ScrollBox1;
panel.Align:=alTop;
//Add a splitter and align it on top (below the panel just created???)
splitter:=TSplitter.Create(ScrollBox1);
splitter.Parent:=ScrollBox1;
splitter.Align:=alTop;
end;
//Add one final panel aligned as client
panel:=TPanel.Create(ScrollBox1);
panel.Align:=alClient;
end;