Solved

DBGrids and getting cell information

Posted on 2001-08-30
5
169 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

Independent Software Vendors: 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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses
Course of the Month10 days, 7 hours left to enroll

632 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