?
Solved

Checkbox in dbgrid

Posted on 1997-11-11
1
Medium Priority
?
728 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
[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
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

Technology Partners: 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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses
Course of the Month13 days, 10 hours left to enroll

801 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