Sorry, I mislead you.
Try this. Add a procedure to Tfm_main
procedure DoSave(Data: PtrInt);
and implement it as
procedure TFrm_main.DoSave(Data: PtrInt);
begin
DBGridvisueel.saveGridLayout(DBGrid_Model, Frm_Main.LastQuery_Model,
ApplicatiePad + '\Settings\'
+ UserName_PC + '_'
+ 'Model.txt');
end;
Then change the OnColMoved event handler to
procedure TFrm_main.DBGrid_ModelColumnMoved(Sender: TObject;
FromIndex, ToIndex: Integer);
begin
Application.QueueAsyncCall(@DoSave, 0);
end;
Leave procedure TDBGrid_visueel.saveGridLayout(...)
unchanged
I think that will give time for the new column data to be updated correctly before it is read by the saving code.