Solved

DBGrids and getting cell information

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

820 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