Solved

DBGrids and getting cell information

Posted on 2001-08-30
5
164 Views
Last Modified: 2010-04-06
i have a grid that is derived from DBCustomGrid and all is ok.

i am trying to add 2 events that i had in my previous Grid that are OnCellColorEvent and a OnSelectedCellColorEvent.
now i did this by getting the Draw cell property overriding what i needed to, added in the events and every thing was fine. ( oh and after you draw the cell you have to redraw the text onto the grid too from the cells variable )

Now the problem i have is that the DBgrid has no cells property and navigating the cleint dataset i have build into my grid and trying to draw the cells is not exactly working out the way i planned...

so on the drawcell event in a dbgrid is there an easy equivelant to the cells property so i can occomplish my mission......?

from the grid rather that the ClientDataset preferably.

Cheers Kristian


0
Comment
Question by:Kristian
  • 3
  • 2
5 Comments
 
LVL 3

Expert Comment

by:Slavak
ID: 6441138
DBGrid have onDrawColumnCell and onDrawDataCell events.
one of them can be a trigger for your custom events
0
 
LVL 1

Author Comment

by:Kristian
ID: 6441199
i tried the onDrawColumnCell and that was useless.
it was ok for doing column coloring, but there is not information anobt the row's data what so ever, even in the columns fielddefs.

and the onDrawDataCell says :
'Do not write an OnDrawDataCell event handler. OnDrawDataCell is obsolete and included for backward compatibility. Instead, write an OnDrawColumnCell event handler.'.
Should i listen or ignore that ??
i listened ( probably stupidly ), but if it is ok to use ( i will try ) i suppose it is what i want..

i will try it but im not holding my breath..

Kris
0
 
LVL 3

Accepted Solution

by:
Slavak earned 100 total points
ID: 6441242
1. For application, that should be supported for long time prefer to listen the comments.

2. In onDrawColumnCell event you can use DBGrid.Fields[DataCol] expression to get a Field. So, you can check the cell data.
0
 
LVL 1

Author Comment

by:Kristian
ID: 6441274
ok will check that.

i wont get a chance until tommorrow now, so i will let you know how it goes then...

Kristian
0
 
LVL 1

Author Comment

by:Kristian
ID: 6477070
Hey Slavak,
just going through my questions, and realised i left this open !!!
i did sirt stuff out eventually, i got it all working well with a lot of faffing and ive learned a lot about how Fields / Columns datasets and Client Datasets work so all is well.

i did end up doing something close to what you sudgested so i must be forced to accept your answer

so cheers for helping,
Kristian.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

760 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now