Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8781397
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T20:17:26+00:00 2026-06-13T20:17:26+00:00

I am looking for an implementation of TFlowPanel (or similar) that will work with

  • 0

I am looking for an implementation of TFlowPanel (or similar) that will work with D5.
Basically I need the TFlowPanel to work inside a TScrollBox (with Vertical scroll bar), so the controls will wrap based on the Width of that TScrollBox.

The images basically show what I need:

enter image description here

After resizing the controls are automatically repositioned:

enter image description here

With Vertical scroll bar:

enter image description here

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T20:17:27+00:00Added an answer on June 13, 2026 at 8:17 pm

    Just a concept. No various FlowTypes, and no possibility to change the order of the controls. You could still move them around by changing the order in the DFM, I think, or by resetting the parent.

    The panel sizes vertically to fit all controls. This means, that when you put it inside a scrollbox it will automatically work.

    unit uAlignPanel;
    
    interface
    
    uses
      Windows, SysUtils, Classes, Controls, ExtCtrls;
    
    type
      TAlignPanel = class(TPanel)
      protected
        procedure SetChildOrder(Child: TComponent; Order: Integer); overload; override;
        procedure SetZOrder(TopMost: Boolean); override;
      public
        procedure AlignControls(AControl: TControl; var Rect: TRect); override;
        procedure Insert(AControl: TControl);
        procedure Append(AControl: TControl);
        function GetChildOrder(Child: TControl): Integer;
        procedure SetChildOrder(Child: TControl; Order: Integer); reintroduce; overload; virtual;
        procedure MoveChildBefore(Child: TControl; Sibling: TControl); virtual;
      end;
    
    procedure Register;
    
    implementation
    
    procedure Register;
    begin
      RegisterComponents('StackOverflow', [TAlignPanel]);
    end;
    
    { TAlignPanel }
    
    procedure TAlignPanel.AlignControls(AControl: TControl; var Rect: TRect);
    var
      i: Integer;
      x, y: Integer;
      LineHeight: Integer;
    begin
      x := 0; y := 0;
      LineHeight := 0;
      for i := 0 to ControlCount - 1 do
      begin
        if x + Controls[i].Width > ClientWidth then
        begin
          x := 0;
          y := y + LineHeight;
          LineHeight := 0;
        end;
        Controls[i].Top := y;
        Controls[i].Left := x;
        x := x + Controls[i].Width;
        if Controls[i].Height > LineHeight then
          LineHeight := Controls[i].Height;
      end;
    
      // Height + 1. Not only looks nices, but also prevents a small redrawing
      // problem of the bottom line of the panel when adding controls.
      ClientHeight := y + LineHeight + 1;
    
    end;
    
    procedure TAlignPanel.Append(AControl: TControl);
    begin
      AControl.Parent := Self;
      AControl.BringToFront;
      Realign;
    end;
    
    function TAlignPanel.GetChildOrder(Child: TControl): Integer;
    begin
      for Result := 0 to ControlCount - 1 do
        if Controls[Result] = Child then
          Exit;
      Result := -1;
    end;
    
    procedure TAlignPanel.Insert(AControl: TControl);
    begin
      AControl.Parent := Self;
      AControl.SendToBack;
      Realign;
    end;
    
    procedure TAlignPanel.MoveChildBefore(Child, Sibling: TControl);
    var
      CurrentIndex: Integer;
      NewIndex: Integer;
    begin
      if Child = Sibling then
        raise Exception.Create('Child and sibling cannot be the same');
    
      CurrentIndex := GetChildOrder(Child);
      if CurrentIndex = -1 then
        raise Exception.CreateFmt( 'Control ''%s'' is not a child of panel ''%s''',
                                   [Sibling.Name, Name]);
    
      if Sibling <> nil then
      begin
        NewIndex := GetChildOrder(Sibling);
        if NewIndex = -1 then
          raise Exception.CreateFmt( 'Sibling ''%s'' is not a child of panel ''%s''',
                                     [Sibling.Name, Name]);
        if CurrentIndex < NewIndex then
          Dec(NewIndex);
      end
      else
        NewIndex := ControlCount;
    
      SetChildOrder(Child, NewIndex);
    end;
    
    procedure TAlignPanel.SetChildOrder(Child: TComponent; Order: Integer);
    begin
      inherited;
      Realign;
    end;
    
    procedure TAlignPanel.SetChildOrder(Child: TControl; Order: Integer);
    begin
      SetChildOrder(TComponent(Child), Order);
    end;
    
    procedure TAlignPanel.SetZOrder(TopMost: Boolean);
    begin
      inherited;
      Realign;
    end;
    
    end.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm looking for an implementation of java.util.Map that has a method that will return
I am looking for an implementation similar to that of what is seen on
I have a trait and an implementation looking like: trait Foo[A] { def bar[B
Looking at the previous implementation of a site that I'm working on, I can
Looking for some implementation advice: I have a page that has a 3-tab ajaxToolkit:TabContainer.
I'm looking for any implementation of a pure Tree data structure for Java (that
I was looking for an implementation of a vertical SeekBar and found this: How
I am looking at the implementation of an API that I am using. I
I am looking for an implementation similar to the type 'id' in objective c
Looking at the implementation on Wikipedia, it would seem that a standard BST (non

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.