Board index » delphi » D2: can't control width of column in DBGrid

D2: can't control width of column in DBGrid

In Delphi 1, when you're selecting and arranging the columns that appear in a
DBGrid, you can set their widths up in the development environment (eg. so
that they occupy the full width of the grid but no more).

I'm having trouble doing this in Delphi 2. Whether I set the column widths by
dragging the separator with the mouse, or by typing in a width in the object
inspector, when I run the application, the widths seem to take on a different
(wider) value, resulting in the appearance of a horizontal scroll bar on the
grid.

Any suggestions?

Clive Backham
Capita Managed Services Ltd. (+44) 1442 872121
cl...@capita.nildram.co.uk

 

Re:D2: can't control width of column in DBGrid


I believe this is a result of not making the fields in the underlying table
persistent.  Double click on the TTable or TQuery and right click in the
resulting window (I think it's called the fields editor) and add the fields
you need to the window.

That should fix the problem.

In article <33f1c5f...@scooby.nildram.co.uk>, cl...@capita.nildram.co.uk

Quote
(Clive Backham) wrote:
> Whether I set the column widths by
>dragging the separator with the mouse, or by typing in a width in the object
>inspector, when I run the application, the widths seem to take on a different
>(wider) value, resulting in the appearance of a horizontal scroll bar on the
>grid.

-----
Ed Hochman - MBH Systems - e...@mbhsys.com

Re:D2: can't control width of column in DBGrid


Quote
In article <5st88u$...@taro.futuris.net>, e...@mbhsys.com (Ed Hochman) wrote:
>I believe this is a result of not making the fields in the underlying table
>persistent.  Double click on the TTable or TQuery and right click in the
>resulting window (I think it's called the fields editor) and add the fields
>you need to the window.

>That should fix the problem.

I'd already tried this and it didn't make any difference.

Quote
>In article <33f1c5f...@scooby.nildram.co.uk>, cl...@capita.nildram.co.uk
>(Clive Backham) wrote:
>> Whether I set the column widths by
>>dragging the separator with the mouse, or by typing in a width in the object
>>inspector, when I run the application, the widths seem to take on a different
>>(wider) value, resulting in the appearance of a horizontal scroll bar on the
>>grid.

Clive Backham
Capita Managed Services Ltd. (+44) 1442 872121
cl...@capita.nildram.co.uk

Re:D2: can't control width of column in DBGrid


try doubleclick at dataset and add all fields, after you have the order
and display sizes of all fields.
[]'s MDMSantos.

Other Threads