[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Checkbox in dbgrid

Posted on 1997-11-11
1
Medium Priority
?
737 Views
Last Modified: 2008-03-10
How can I get a logical field to show up as a checkbox in a dbgrid?
0
Comment
Question by:lizzzard
1 Comment
 
LVL 1

Accepted Solution

by:
sassas081597 earned 150 total points
ID: 1350017
I give you an idea only. Set DefaultDrawing property of DBGrid to false.
Write the following procedure (I do not draw the checkbox, I only change the color of the cell. The canvas is in your hands. Draw all that you want).

procedure TForm1.DBGrid1DrawDataCell(Sender: TObject; const Rect: TRect;
  Field: TField; State: TGridDrawState);
begin
     If Field.AsBoolean then
     DBGrid1.Canvas.Brush.Color:=clGreen
     else
     DBGrid1.Canvas.Brush.Color:=clRed;
     DBGrid1.Canvas.FillRect(Rect);
end;
At least write the OnClickMethod for these columnes to exchange True and False;
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

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…
Loops Section Overview
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

872 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