Solved

DBGrids and getting cell information

Posted on 2001-08-30
5
168 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

751 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