checkbox in grid (Kgrid or DBgrid) lazarus / 31-LCL ---------------------------------------------------------------------- christensen · 2011-10-21 07:50 Hi, I want to display the boolean field content in checkbox but it doesn't work. My db engine is Firebird 2.1.3, but what's mean boolean type field?! QuoteNo BOOLEAN field in Firebird? Boolean field is available since Firebird 3.0. For versions prior to 3.0, but you have several alternatives: 1. use char(1) 2. use smallint 3. use domainshttp://www.firebirdfaq.org/faq12/ I've choose "smallint" type fiels and the values are 0=unchecked, 1=checked  I've try to use this tutorial http://wiki.lazarus.freepascal.org/Grids_Reference_Page but in my case i don't have this type of event: "DBGrid1UserCheckboxState" only "DBGrid1UserCheckboxBitmap" in DBGRID but in the Kgrid i don't have at all. The same for delphi tutorial http://delphi.about.com/od/usedbvcl/l/aa082003a.htm I prefer to solve it for Kgrid if is possible. Thanks ---------------------------------------------------------------------- JD · 2011-10-21 12:38 Take a look at the kgriddemolaz example in the \demos directory. It shows how you can embed controls into a KGrid. http://www.lazarus.freepascal.org/index.php/topic,14929.msg79682.html# msg79682 ---------------------------------------------------------------------- Zoran · 2011-10-21 14:13 See the application attached to this post, it uses DBGrid and database employee which you get with firebird installation. You will see that in application there are two columns named "PAID". It's actually one column, but the grid shows it twice, once with "y" and "n", as it is in underlying database, and once to show you how to use check boxes. The database "employee" used here you should find in "C:\Program Files\Firebird\Firebird_2_1\examples\empbuild\EMPLOYEE.FDB" if you are on Windows. On Ubuntu, you should install it, see in lower section of this document: http://www.firebirdsql.org/manual/ubusetup.html ---------------------------------------------------------------------- christensen · 2011-10-21 19:05 Thanks @Zoran, the checkbox in DBgrid it work like a charm. @JD i prefer to use Kgrid instead of DBgrid, until i figure out how can be done, i will use DBgrid. ---------------------------------------------------------------------- christensen · 2011-10-26 06:49 Ok i found the solution to display the chechbox on Kgrid, but now a new problem have appeared Code: [Select]procedure TForm1.KDBGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;   R: TRect; State: TKGridDrawState); begin   KDBGrid1.CellPainter.CheckBox := True; end;take a look on the attachment: EDIT: i had change the picture .... from mistake i've upload the wrong one ....sorry