Solved

DBGrids and getting cell information

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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
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…

786 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