Change cell value through objects lazarus / 31-LCL ---------------------------------------------------------------------- pmesquita · 2021-11-18 16:03 Folks... How can I change the value of a cell through a function of an object contained in it? What I have in mind so far is the attached unit... I don't know if I'm on the right path... but that's what I have so far... Change cell's value.. 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 StringGrid1.Cell[3, 3].AsString:= TimeToStr(Now); Any tips or not how to do this...? ---------------------------------------------------------------------- pmesquita · 2021-11-18 16:40 It's actually Cells because my idea is to use another property where I can access all the properties of the TStrinGridCell object. Because there was a simple example, but there will be other information that I will have to "inject" into the cell besides the text... ---------------------------------------------------------------------- pmesquita · 2021-11-18 16:50 I found the solution... And the ITStringGridInterface interface is not required... 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 TStringGridCell.AddValue(ACol, ARow: Integer; AValue: String);begin  TStringGrid(Owner).Cells[ACol, ARow]:= AValue;end; ---------------------------------------------------------------------- wp · 2021-11-18 16:51 But why does TStringGridCell inherit from TStringGrid? Looks wrong... ---------------------------------------------------------------------- pmesquita · 2021-11-18 16:55 Until then, it was the only way that, inside the TStringGridCell object, I could edit the value of the cell that I passed as a parameter in the Cell... property. The other idea I have is: For each object of each cell I pass the canvas of the TStringGrid and when the value changes I use the canvas to draw... But is there a better solution...? since i don't usually create and edit components so my knowledge in this area is zero..kkk ---------------------------------------------------------------------- wp · 2021-11-18 17:40 I see the problem how to create the TStringGridCell at an arbitray location in the grid. So far you only create it at col=3/row=3. Initially you do not know where the user will add information, and on the other hand it's an overkill to add a TStringGridCell everywhere. ---------------------------------------------------------------------- pmesquita · 2021-11-18 17:54 QuoteI see the problem how to create the TStringGridCell at an arbitray location in the grid. So far you only create it at col=3/row=3. In this case it was just an example because the grid has 8 rows/columns... Because the grid will start RowCount = 1 so when the user calls the AddRows procedure it will automatically create objects for each cell.. Because the idea is the same as TStringGrid.Cells[Col, Row] but instead of accepting only String, it is to have more information in the referenced cell, for example: Code/Hint... only specific for that cell... But why do I have to make a TypeCast of "Objects" to access the object in question, if I can create a property that already does this for me and that facilitates reading/writing the code Basically the idea is this...