Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2005.12.04;
Скачать: CL | DM;

Вниз

Panels and Splitters   Найти похожие ветки 

 
FBuilder   (2005-11-06 11:34) [0]

В цикле создаю сплитер, панель, сплитер, панель.
Все выставляется:

   Splitter := TSplitter.Create(VirtualMainPanel);
   Splitter.Parent := VirtualMainPanel;
   Splitter.Align := alBottom;
   Splitter.Height := 3;

   Panel := TPanel.Create(VirtualMainPanel);
   Panel.Parent := VirtualMainPanel;
   Panel.Align := alBottom;

Получаю 2 панели, лежащие внизу, а выше них - 2 сплитера.
Как обойти косяк??


 
jack128 ©   (2005-11-06 11:50) [1]

чего то ты недоговариваешь. Вот, все как надо создается

var
 i: Integer;
begin
 for i := 0 to 1 do
 begin
   with TPanel.Create(Self) do
   begin
     Parent := Self;
     Align := alBottom;
   end;
   with TSplitter.Create(Self) do
   begin
     Parent := Self;
     Align := alBottom;
     Height := 3;
   end;
 end
end


 
FBuilder   (2005-11-06 14:56) [2]


...
>    with TPanel.Create(Self) do
>    begin
>      Parent := Self;


Да, так создается, а вот если на Panel создавать (не Self) - оно не правильно создается :(
Почему?


 
jack128 ©   (2005-11-06 16:06) [3]

 procedure CreatePanelsAndSplitters(AParent: TWinControl);
 const
   Count = 2;
 var
   i: Integer;
   CreationControls: array [0..Count * 2 - 1] of TControl;
 begin
   for i := 0 to Count - 1 do
   begin
     CreationControls[i * 2] := TPanel.Create(AParent);
     CreationControls[i * 2].Parent := AParent;
     CreationControls[i * 2 + 1] := TSplitter.Create(AParent);
     with CreationControls[i * 2 + 1] do
     begin
       Parent := AParent;
       Height := 3;
     end;
   end;
   with CreationControls[Low(CreationControls)] do
   begin
     Top := AParent.Height; // Помещаем первый контрол в самый низ родителя
     Align := alBottom;
   end;
   for i := low(CreationControls) + 1 to High(CreationControls) do
   begin
     CreationControls[i].Top := CreationControls[i - 1].Top - CreationControls[i].Height; // А все последующие ВЫШЕ предыдущего. Этим и задается порядок расположения контролов при одинаковом Align
     CreationControls[i].Align := alBottom;
   end;
 end;



Страницы: 1 вся ветка

Текущий архив: 2005.12.04;
Скачать: CL | DM;

Наверх




Память: 0.47 MB
Время: 0.045 c
5-1115983434
Другой Дмитрий
2005-05-13 15:23
2005.12.04
Проблема при разделении designtime and runtime package на два


14-1132052141
oleggar
2005-11-15 13:55
2005.12.04
clipper deploy


2-1132216256
Creator__
2005-11-17 11:30
2005.12.04
Глюк Delphi 2005 или я чего-то недопонимаю...


14-1132019181
Лентя
2005-11-15 04:46
2005.12.04
А нет ли такого устройства, чтобы пультом можно было свет включат


2-1131968060
igi
2005-11-14 14:34
2005.12.04
как сделать аналог dup()