?
Solved

How to set fixedRows in DBGrid component

Posted on 2006-05-18
11
Medium Priority
?
729 Views
Last Modified: 2010-04-04
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
0
Comment
Question by:Fled
  • 6
  • 5
11 Comments
 
LVL 26

Expert Comment

by:Eddie Shipman
ID: 16718561
Ylu *can* use a "class cracker" like this:

type
  TMyDBGrid = class(TDBGrid);

procedure TForm1.Button1Click(Sender: TObject);
begin
  TMyDBGrid(DBGrid1).FixedCols := 2;
end;


But, you are also going to have to override the OnDrawColumnCell and rework the
painting of the fixed columns.
0
 

Author Comment

by:Fled
ID: 16763487
This does not work in Delphi7 with XP computer. No matter for  what it is displayed in the fixed Colones.
Thanks
0
 
LVL 26

Expert Comment

by:Eddie Shipman
ID: 16764218
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.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:Fled
ID: 16770105
Yes fixedCol instead of fixedRow. Sorry :)
0
 
LVL 26

Expert Comment

by:Eddie Shipman
ID: 16790188
The code I showed MADE A FIXED COLUMN. You will need to override the OnDrawColumnCell  to
rework the drawing of the cells, though.
0
 

Author Comment

by:Fled
ID: 16819205
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.
0
 
LVL 26

Expert Comment

by:Eddie Shipman
ID: 16819729
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.
0
 

Author Comment

by:Fled
ID: 16853477
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
0
 
LVL 26

Expert Comment

by:Eddie Shipman
ID: 16855443
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.
0
 

Author Comment

by:Fled
ID: 16906633
Do you mean that I must create a descendant of TDBGrid to have a fixed column? no way else? it seems hard
Thanks
0
 
LVL 26

Accepted Solution

by:
Eddie Shipman earned 500 total points
ID: 16907162
yepper. If I were you, I'd choose a 3rd-party grid. Standard TDBGrid is not flexible
enough for this.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question