Jump to content
Henry Olive

Wrap texts in DBGrid

Recommended Posts

D-10,4

Good Day

 

MyField = Varchar(1500)

MyDBGrid.Width = 400

 

Is it possible to wrap texts inside each row if my field's data longer than dbgrid field width ?

Something like below

 

ID    History

1      aaaaaa

        bbbbb

        cccccc

2      xxxxxx

 

Thank You

 

Share this post


Link to post
On 11/21/2024 at 8:23 AM, Henry Olive said:

D-10,4

Good Day

 

MyField = Varchar(1500)

MyDBGrid.Width = 400

 

Is it possible to wrap texts inside each row if my field's data longer than dbgrid field width ?

Something like below

 

ID    History

1      aaaaaa

        bbbbb

        cccccc

2      xxxxxx

 

Thank You

 

TDBGrid does not support that. If you have fields with long text a grid is not the best way to show it, better use a TDBMemo in addition to the grid and tie it to the field in question. It will them show the field content of the record active in the grid as the user scrolls through the records.

Share this post


Link to post
On 11/21/2024 at 8:23 AM, Henry Olive said:

D-10,4

Good Day

 

MyField = Varchar(1500)

MyDBGrid.Width = 400

 

Is it possible to wrap texts inside each row if my field's data longer than dbgrid field width ?

Something like below

 

ID    History

1      aaaaaa

        bbbbb

        cccccc

2      xxxxxx

 

Thank You

 

You can draw whatever you want in OnDrawColumnCell but AFAIK, all rows must have the same height.

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

×