Recent

Author Topic: dBGRidController and Error Message : Access Violation  (Read 534 times)

essence-ciel

  • New Member
  • *
  • Posts: 19
dBGRidController and Error Message : Access Violation
« on: June 16, 2025, 06:31:37 am »
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 :
Code: Pascal  [Select][+][-]
  1.   FHERITAGE := TFHERITAGE.Create(Self);
  2.   ColoreGrille(FHERITAGE);
  3.   FHERITAGE.ShowModal;
  4.   FHERITAGE.Free;
  5.  

ColoreGrille procedure :
Code: Pascal  [Select][+][-]
  1. procedure TFSoins64.ColoreGrille(Forme : TForm);
  2. begin
  3.   for I := 0 to Forme.ComponentCount -1 do
  4.   if (Forme.Components[I] is TdBGrid) then
  5.      TdBGrid(Forme.Components[I]).AlternateColor := StyleAppli[ComboBox1.ItemIndex];
  6. end;  
  7.  

and Heritage Form code...
Code: Pascal  [Select][+][-]
  1. procedure TFHeritage.FormActivate(Sender : TObject);
  2. begin
  3.   FHeritage.Width                    := 438;
  4.   FHeritage.Caption                 := 'Soigner V 3.00 64bit - Affections';
  5.   dBGrid1.DataSource              := DataModule1.DAffections;
  6.   dBGrid1.Width                      := 435;
  7.   dBGrid1.Columns.Clear;
  8.   dBGrid1.Columns.Add;
  9.   DBGrid1.Columns[0].FieldName        := 'Affection';
  10.   dBGrid1.Columns[0].Width               := 400;
  11.   dBGrid1.Columns[0].Title.Caption     := 'Affections et malaises';
  12.   dBGrid1.Columns[0].Title.Alignment := taCenter;
  13.   dxdBGridController1.dBGrid             := dBGrid1;
  14.   //***************** dxDBGridController  ************
  15.   If Assigned(dxDBGridController1) Then FreeAndNil(dxDBGridController1);
  16.   dxDBGridController1                := TdxDBGridController.Create(self);
  17.   dxDBGridController1.Name           := 'dxDBGridController1';
  18.   dxdBGridController1.dBGrid         := dBGrid1;  
  19. end;
  20.  
  21. procedure TFHeritage.FormCreate(Sender : TObject);
  22. begin
  23.   DataModule1.TAffections.Open;
  24. end;
  25.  
  26. procedure TFHeritage.FormDestroy(Sender : TObject);
  27. begin
  28.   DataModule1.TAffections.Close;
  29. end;  
  30.  

and my Heritage form is closed with :
Code: Pascal  [Select][+][-]
  1. procedure TFHeritage.FormCloseQuery(Sender : TObject; var CanClose : Boolean);
  2. begin
  3.   DataModule1.TAffections.Close;
  4.   CanClose := True;
  5. end;    
  6.  

I don't understand where the access violation is...
Have somebody an idea ?

essence-ciel

  • New Member
  • *
  • Posts: 19
Re: dBGRidController and Error Message : Access Violation
« Reply #1 on: June 18, 2025, 01:15:11 am »
Resolved, thanks !

 

TinyPortal © 2005-2018