Good morning
I connect to the oracle database I have tables to which we need to add a chekbox column, we do according to the wiki and unfortunately I still have selected
unit Unit1;
{$ mode objfpc} {$ H +}
interface
uses
Classes, SysUtils, oracleconnection, SQLDB, DB, Forms, Controls, Graphics,
Dialogs, DBGrids, StdCtrls, DBCtrls, ValEdit, DBDateTimePicker;
type
{TForm1}
TForm1 = class (TForm)
DataSource1: TDataSource;
DBGrid1: TDBGrid;
Label1: TLabel;
OracleConnection1: TOracleConnection;
SQLQuery1: TSQLQuery;
SQLTransaction1: TSQLTransaction;
procedure DBGrid1CellClick (Column: TColumn);
procedure DBGrid1UserCheckboxState (sender: TObject; column: TColumn; var AState: TCheckboxState);
procedure FormCreate (Sender: TObject);
procedure FormDestroy (Sender: TObject);
private
public
RecList: TBookmarklist;
end;
var
Form1: TForm1;
implementation
{$ R * .lfm}
{TForm1}
procedure TForm1.DBGrid1CellClick (Column: TColumn);
begin
if Column.Index = 1 then
RecList.CurrentRowSelected: = not RecList.CurrentRowSelected;
end;
procedure TForm1.FormCreate (Sender: TObject);
begin
RecList: = TBookmarkList.Create (DbGrid1);
end;
procedure TForm1.FormDestroy (Sender: TObject);
begin
RecList.Free;
end;
procedure TForm1.DBGrid1UserCheckboxState (sender: TObject; column: TColumn; var AState: TCheckboxState);
begin
if RecList.CurrentRowSelected then
AState: = cbChecked
else
AState: = cbUnchecked;
end;