A tiny detail about custom cell editors in a TStringGrid lazarus / 31-LCL ---------------------------------------------------------------------- Al3 · 2025-02-02 14:16 Apologies for asking something that might be answered by inspecting sources, this is just my 4th Lazarus project, so I am still pretty new to Object Pascal. It's so fun to work with it I am not giving enough care to my C projects ... Because I cannot get the normal cell editor control font color to change (something makes it white, which is the same color as the background and therefore the text is invisible), I am providing a custom TEdit through OnSelectEditor. Lots of stuff must be handled manually it seems, but here is what I have thus far just in case someone needs it: 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 TMyStringGrid.onMyResize (Sender: TObject);var    Grid:   TStringGrid;    CR:     TRect;begin    Grid := Sender as TStringGrid;    if not Assigned(Grid.Editor) then Exit;    CR := Grid.CellRect(Grid.Col, Grid.Row);    //TEdit(Grid.Editor).BoundsRect := Grid.CellRect(Grid.Col, Grid.Row);    TEdit(Grid.Editor).BoundsRect := Rect(CR.Left, CR.Top+3, CR.Right, CR.Bottom+3);end; procedure TMyStringGrid.onMySelectEditor(Sender:        TObject;                                       aCol:          Integer;                                       aRow:          Integer;                                       var Edit:      TWinControl);var    Grid:   TStringGrid;    myEdit: TEdit;    CR:     TRect;begin     (* Get Grid *)    Grid := Sender as TStringGrid;      (* Create Editor *)    myEdit := TEdit.Create(Sender as TComponent);    myEdit.Hide;     CR            := Grid.CellRect(aCol, aRow);     (* Configure Editor *)    myEdit.AutoSelect   := false; // TCDEdit does not need this    myEdit.Parent       := Sender as TWinControl;    myEdit.Text         := Grid.Cells[aCol, aRow];    myEdit.Alignment    := Grid.Columns.Items[aCol-1].Alignment;     (* Alignment *)    //myEdit.BoundsRect := CR    myEdit.BoundsRect := Rect(CR.Left, CR.Top+3, CR.Right, CR.Bottom+3);     (* Style *)    //myEdit.Brush.Color := clRed;    myEdit.Color := Grid.Columns[aCol-1].Color;    myEdit.Font.Color := clWhite;    myEdit.BorderStyle := bsNone;     myEdit.CaretPos   := TPoint.Create(Length(myEdit.Text), 0);     (* Assign editor *)    Edit := myEdit;    myEdit.Show;end; The only problem I have is that the handler is signaled even with the goAlwaysShowEditor option not set. If I don't attach a handler to this signal, the default edit appears after I focus and click/activate a particular cell, which is the expected behavior. This means that some other wizardry is happening on the default edit control to behave like that, but I have no idea what. Does it create some clickable canvas first? What is the correct easiest way to do that? ---------------------------------------------------------------------- Al3 · 2025-02-04 07:26 The default cell edit, it's font color was overridden by the TStringGrid's parent font color. I guess I'll stick to that.