Link to home
Start Free TrialLog in
Avatar of Freerider
FreeriderFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Check Box in DBGrid?

Hi All,

I'm new to Delphi...

I have an access database which, when I open in Access, one of the fields (Boolean) appears as a checkbox. When I open the table in Delphi6, the field contains True or False. Is there any way I can get the DBGrid to show a checkbox instead?

Thanks,
Freerider.
Avatar of aikimark
aikimark
Flag of United States of America image

listening & learning
Avatar of alanwhincup
alanwhincup

Take a look at http://www.delphi3000.com/article.asp?ID=2151 for 'Displaying a checkbox within a DBGrid for use with Boolean fields' article .
ASKER CERTIFIED SOLUTION
Avatar of inthe
inthe

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Freerider

ASKER

Thanks Alan, but I didn't really understand the explanation @truepath.com - can you make it a bit easier to understand??

ginsonic, I couldn't find the link at delphi3000.com

Still looking...
Freerider.
All the code is basically doing is drawing a checkbox inside of any Boolean fields within a dbgrid. What exactly is it you don't understand about it? Anything specific, or just all of it?
The problem is my limited understanding of the structure of Delphi programming - I couldn't see from the example, how I could recreate it in my program (ie which controls I should put on the form).

It doesn't matter now, cos I took inthe's advice and used a DBCheckBox instead - I don't really need the DBGrid...

Thanks,
Freerider
Freerider ,
I just tested the link and is OK . But before read , you must register to this site.

For the most options  you must to pay but ....

The registration is FREEWARE and the first 50 articles from the base are FREEWARE too . You must to pay JUST if you wish to search more articles in the base.

In same time if you visit every day this site you can read the last article posted in that day for FREE .

So if you don't wish to pay visit every day this site and can read forever the new articles .
HI, FreeRider,
All what you want you can do by yourself, it's not so difficult as it seems from the first sight.
You must put TCheckbox component on your from with DBGrid
and in the OnDrawColumnCell DBGrid event write the code
to place the CheckBox on that cell which is currently selected (with a width and a height equal to the corresponding Rect).
The rest is simple (to fill OnClick event of the CheckBox).
Sincerely,
Nestorua.