Problem with ediing data in grid

TeeGrid VCL / FMX for Embarcadero RAD Studio, Delphi, C++ Builder and Lazarus Free Pascal.
Post Reply
HarryKalma
Newbie
Newbie
Posts: 14
Joined: Thu Aug 03, 2017 12:00 am

Problem with ediing data in grid

Post by HarryKalma » Mon Jan 22, 2018 2:13 pm

I have 2 grids on form.
1 - Main data.
2 - Slave data. Data changes all time when I change maindata row.

If I edit data in slave grid and after editing make click in same (slave) grid -- all is fine.
Only if after editing I make click on maindata grid, I get:
at first: FastMM error: error during GetMem operation. Block has been modified being freed
at second: system error: Out of memory.

HarryKalma
Newbie
Newbie
Posts: 14
Joined: Thu Aug 03, 2017 12:00 am

Re: Problem with ediing data in grid

Post by HarryKalma » Wed Jan 24, 2018 10:40 am

Problem resolved (partly) by adding the following code:

Code: Select all

procedure TMainForm.tgrdAttributesCellEdited(const Sender: TObject;
  const AEditor: TControl; const AColumn: TColumn; const ARow: Integer;
  var ChangeData: Boolean; var NewData: string);
begin
  if MainForm.Focused.GetObject <> tgrdAttributes then
    ChangeData:= False;
end;
onCellEdited not fired before onExit event.

It's still a problem. In this example, the data entered by the user is destroyed. How to store them?

HarryKalma
Newbie
Newbie
Posts: 14
Joined: Thu Aug 03, 2017 12:00 am

Re: Problem with ediing data in grid

Post by HarryKalma » Wed Jan 24, 2018 11:10 am

NB. I use FMX.

Yeray
Site Admin
Site Admin
Posts: 8704
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Problem with ediing data in grid

Post by Yeray » Thu Jan 25, 2018 7:57 am

Hello,

Could you please arrange a simple example so we can reproduce the problem here?
Thanks in advance.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

HarryKalma
Newbie
Newbie
Posts: 14
Joined: Thu Aug 03, 2017 12:00 am

Re: Problem with ediing data in grid

Post by HarryKalma » Thu Jan 25, 2018 2:39 pm

Exact error duplication:
A) Select the first line of mastergrid (Left grid).
b) Edit slave cell (right grid).
c) Left the changed cell with the mouse and click on the mastergrid last line.

A slightly different error occurs when after edit click mastergrid second or third line.

Demo location: https://www.online.ee/sharefile.php?sha ... 8249e07f9f

Yeray
Site Admin
Site Admin
Posts: 8704
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Problem with ediing data in grid

Post by Yeray » Fri Jan 26, 2018 10:25 am

Hello,

You are copying your original data to MainSlaveData everytime you select a new row in the main grid. This is overriding the changes in MainSlaveData.
Instead, you could use an array to access your slave data. Ie:
Demo to Steema.zip
(48.78 KiB) Downloaded 106 times
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply