TAdvScrollBox Controlls

Goodafternoon to all,

j have on a form one TAdvScrollBox who j populate in Runtime.

The procedure j use it's like this



Procedure Form1..InsertControl;

Var FP   : TFrame;

begin

// Insert the conroll

FP:=TFrame.Create(Nil);

FP.Parent:=TadvScrollBox1;

FP.Align:=alTop; // Now align the control to TOP

end;



Now this procedure work well BUT, each control j add aftre the first, it will be ALWAYS the FIRST.

For example j need to insert 10 frames in order to have1..10 where 1 is the first and 10 is the last one in list.

But with the procedure as j post, j got the reverse as the last is the first and the first is the last

as 10..1



There's a way to obtain the correct insert controls list from 1..10 ???



Thank's in avance for the reply.



Good nigth



Daniele



PS: According with delphi help to insert a new control in a scrollbox we must use the parent property, so it's not a bad thing to have a procedure/function that can give us the possibilty to insert a frame/control in any position in a scrollbox.

If this already exists ..... excuse me and j give you some candies !!!!!



Hi to all,

another problem ....

Now the vertical scrollbar does not be showing !!!!! at all !!!



J tryied to delete and reinsert the component ... but nothing append !!!



any suggestions ???



Thank's



Daniele

hi again,

in reply to my second post (vertical scrollbar) hi found a post



https://forums.embarcadero.com/thread.jspa?threadID=81106



So in the procedure j posted j added



PostMessage(TAdvScrollBox1.handle, wm_size, 0, 0);



In this way when a new frame is added and the visual are goes out to scrollbox client area, the vertical scroll bar is show and all the controls are resized.



Good nigth



Daniele

I cannot see a problem with the scrollbar.
Dropping a default TAdvScrollBox on the form and adding the code:


procedure TForm5.Button1Click(Sender: TObject);
var
  pnl: TPanel;
begin
  pnl := TPanel.Create(AdvScrollBox1);
  pnl.Parent := AdvScrollBox1;
  pnl.Left := 100;
  pnl.Top := 100;
  pnl.Width := 200;
  pnl.Height := 200;
end;

shows both horizontal & vertical scrollbars.
What are you doing different from this?

Hi Bruno,

thank's for your reply ....



The main problem remain the first ..... as for insert frame position in component array.

Now seem that each frame j insert, it goes Always in first position but, what j need do have is the first frame is in first position, the second frame in second position and so on (1..10).



About the vertical scroll bar in a form insert a TadvScrollBox and add some frame with



Frame : TFrame;



For A::=0 to 10 do

begin

   Frame:=TFrame.Create(Nil);

   Frame.Akign:=alTop

   Frame.Parent:=TAdvScrollBox1;

end;



In my project when the all the frames are in the scrollbox and, even, the frames are over the client area, the vertical scroll bar is not show.

But if j post the line

PostMessage(TAdvScrollBox1.handle, wm_size, 0, 0);

j gor the scrollbar.



As j sed before, the main problem is how to insert a frame in a certain array position.



Thank's for your attention.



Have a good weekend



Daniele



This is a behavior that is a VCL control alignment behavior rather than something specific in TAdvScrollBox. If you want to control the order of the aligned frames, first set the .Left property to a value higher than previous frames and after that, set Align = alTop.