Hello,
I'm working on Windows 10, Lazarus 4.00, ZeosdBO 8.0 and SqLite 3.50.1. First, sorry for my bad english.
I've discovered dBGridController recently and try to implement it because it seems powerful and fast, but I'm not familiar with it and I haven't found any tuto about it.
At runtime, when I close the form, I get the following error message: Access violation
Call of the form :
FHERITAGE := TFHERITAGE.Create(Self);
ColoreGrille(FHERITAGE);
FHERITAGE.ShowModal;
FHERITAGE.Free;
ColoreGrille procedure :
procedure TFSoins64.ColoreGrille(Forme : TForm);
begin
for I := 0 to Forme.ComponentCount -1 do
if (Forme.Components[I] is TdBGrid) then
TdBGrid(Forme.Components[I]).AlternateColor := StyleAppli[ComboBox1.ItemIndex];
end;
and Heritage Form code...
procedure TFHeritage.FormActivate(Sender : TObject);
begin
FHeritage.Width := 438;
FHeritage.Caption := 'Soigner V 3.00 64bit - Affections';
dBGrid1.DataSource := DataModule1.DAffections;
dBGrid1.Width := 435;
dBGrid1.Columns.Clear;
dBGrid1.Columns.Add;
DBGrid1.Columns[0].FieldName := 'Affection';
dBGrid1.Columns[0].Width := 400;
dBGrid1.Columns[0].Title.Caption := 'Affections et malaises';
dBGrid1.Columns[0].Title.Alignment := taCenter;
dxdBGridController1.dBGrid := dBGrid1;
//***************** dxDBGridController ************
If Assigned(dxDBGridController1) Then FreeAndNil(dxDBGridController1);
dxDBGridController1 := TdxDBGridController.Create(self);
dxDBGridController1.Name := 'dxDBGridController1';
dxdBGridController1.dBGrid := dBGrid1;
end;
procedure TFHeritage.FormCreate(Sender : TObject);
begin
DataModule1.TAffections.Open;
end;
procedure TFHeritage.FormDestroy(Sender : TObject);
begin
DataModule1.TAffections.Close;
end;
and my Heritage form is closed with :
procedure TFHeritage.FormCloseQuery(Sender : TObject; var CanClose : Boolean);
begin
DataModule1.TAffections.Close;
CanClose := True;
end;
I don't understand where the access violation is...
Have somebody an idea ?