TStringGrid Row & Col problems lazarus / 31-LCL ---------------------------------------------------------------------- simone · 2019-08-02 21:22 I need to process data stored in cells of a stringgrid after they are edited/modified by user. At this purpose I use Row and Col property inside OnEditingDone event handler to detect what cell is changed, but it seems to me that above properties return random values (see attached program demo, built with Lazarus 2.0.2 - Win64)… Is it a bug? Thanks for the help ---------------------------------------------------------------------- wp · 2019-08-02 21:42 Looks pretty logical to me. What exactly is displayed for which cell? I modified your OnEditingDone such that the Col:Row indexes are written back to the edited cell, and I get what I am expecting: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TForm1.StringGrid1EditingDone(Sender: TObject);begin  StringGrid1.Cells[StringGrid1.Col, StringGrid1.Row] :=    'C'+StringGrid1.Col.ToString+':R'+StringGrid1.Row.ToString;//  Edit1.T ext:='C'+StringGrid1.Col.ToString+':R'+StringGrid1.Row.ToString;end; ---------------------------------------------------------------------- simone · 2019-08-02 22:20 Thanks wp. You are right: the behavior is correct. I misunderstood the values of row and col. Another question: Using 'OnEditingDone' I can only detect changes of cell content after editing is terminated. It's possible to handle changes while typing? Thank again. ---------------------------------------------------------------------- wp · 2019-08-03 10:43 You can hook into the OnSetEditText event which passes the contents of the cell editor to the grid after each key press: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TForm1.StringGrid1SetEditText(Sender: TObject; ACol, ARow: Integer;  const Value: string);begin  Edit1.Text := Value;end; ---------------------------------------------------------------------- simone · 2019-08-03 11:10 Thanks Wp. I was looking for a property named 'OnChange', as in others components. I didn't realize that 'OnSetEditText' could be useful for this purpose. ---------------------------------------------------------------------- wp · 2019-08-03 11:28 It is probably named like this because it belongs to the setter/getter events for interaction with the cell editor: OnGetCellText passes the current cell text to the cell editor when editing become active, and OnSetCellText returns the currently edited text back to the grid. The choice of "Set"/"Get" is a bit strange here, though.