Fled
asked on
How to set fixedRows in DBGrid component
Hi,
I have a form with a dbgrid displaying some information. I need to set a status colon as a fixedrow. I did it with stringGrid component but i m not able to do it with DBGrid. Any help
Thanks
I have a form with a dbgrid displaying some information. I need to set a status colon as a fixedrow. I did it with stringGrid component but i m not able to do it with DBGrid. Any help
Thanks
ASKER
This does not work in Delphi7 with XP computer. No matter for what it is displayed in the fixed Colones.
Thanks
Thanks
This doesn't make sense: "I need to set a status colon as a fixedrow"
Make a Column a fixed ROW?
Please explain further what you want or did with TStringGrid.
Make a Column a fixed ROW?
Please explain further what you want or did with TStringGrid.
ASKER
Yes fixedCol instead of fixedRow. Sorry :)
The code I showed MADE A FIXED COLUMN. You will need to override the OnDrawColumnCell to
rework the drawing of the cells, though.
rework the drawing of the cells, though.
ASKER
I left the OnDrawColumnCell to the default, does not matter what is displayed in the cell, I expect to get an empty Fixed column with your code but it does nothing in delphi7. Did you test it with this version of delphi?
Thank you.
Thank you.
Yes, I wrote it using Delphi 7. The Fixed column should contain the data that is in the second column.
I was unaware that you wanted an EMPTY fixed column. If that's the case, we'll do something different.
I was unaware that you wanted an EMPTY fixed column. If that's the case, we'll do something different.
ASKER
The First cell of the fixed column (Title cell) does not look like the others cells. I mean it s white with out caption.
Thanks
Thanks
You have to remember that TDBGrid is designed to work a specific way. To override the behavior of how
the cells are drawn, you will have to override the protected DrawCell method in a descendant.
the cells are drawn, you will have to override the protected DrawCell method in a descendant.
ASKER
Do you mean that I must create a descendant of TDBGrid to have a fixed column? no way else? it seems hard
Thanks
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
type
TMyDBGrid = class(TDBGrid);
procedure TForm1.Button1Click(Sender
begin
TMyDBGrid(DBGrid1).FixedCo
end;
But, you are also going to have to override the OnDrawColumnCell and rework the
painting of the fixed columns.