Jump to content
Tom F

Looking for a grid that adds columns as it's widened

Recommended Posts

Is there a VCL component (preferably included in the current Delphi)  that shows a grid of items that automatically adds and removes columns as it's resized?

I want to show items in alphabetical order across each row, as shown below. (Horizontal snaking)

 

As the grid is resized (when the user resizes its form), I want the grid to automatically add more columns, repopulating as shown below.

 

I know I could populate a TStringGrid, but I'd have to monitor the current width, determine how many columns it can accommodate, resize the grid and then repopulate, etc.  Rather than re-inventing the wheel (mine would be wobbly and squeak!) I'd rather just hand a TStringList to a pre-existing visual component and have it handle the details.

 

In case I want to create my own from a TStringGrid, the OnResize event fires multiple times as a user drags the borders of the form.  How do I detect that the user has finished resizing so I can repopulate the grid?

 

Three columns

A   B  C
D   E  F
G   H  I

 

When the user widens the form so that it's wide enough for five columns, it would look like this:

Five Columns
A   B   C   D  E
F   G   H   I     

 

One Column

A

B

C

C

D

F

G

H
I

 


 

Share this post


Link to post

The standard windows List-View control, wrapped by the Delphi TListView component does this.

The Tile View style is probably what fits your requirements best but unfortunately that isn't directly supported by TListView. Google Delphi LV_VIEW_TILE to find solutions around that.

  • Like 1

Share this post


Link to post
1 hour ago, Anders Melander said:

The standard windows List-View control, wrapped by the Delphi TListView component does this.

Thanks, Anders.  The List-View control works great for my purposes. THANKS!!

 

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×