StringGrid with goRowSelect=true does not go to right cell when I press TAB. lazarus / 31-LCL ---------------------------------------------------------------------- ademir.uem · 2016-04-23 17:11 When I use StringGrid with goRowSelect=true when I press Tab it go down only. Even I select AutoAdvance=aaRight, it never to to Right cell. It is correct? I am setting goAlwaysShowEditor, goEditing, goTabs to True. ---------------------------------------------------------------------- wp · 2016-04-23 17:26 Don't use goRowSelect, it always highlights an entire row; to select single cells it must be off. Then, select the Option goTabs, it makes the grid's active cell advance on the tab key - but you already have this on. AutoAdvance determines how the active cell advances if you end editing by pressing the ENTER key, aaRight moves it to the right ---------------------------------------------------------------------- ademir.uem · 2016-04-23 17:35 But I want highlights an entire row, so have used goRowSelect for that. What is the other solution for this? Anyway, when I does not use the  Inplace editor (I replace to another), so it work fine, as I would like. I don understand. ---------------------------------------------------------------------- wp · 2016-04-23 18:03 Have the goRowSelect off and fake the rowselect by painting the selected row in the highlight color? 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.StringGrid1PrepareCanvas(sender: TObject; aCol, aRow: Integer;  aState: TGridDrawState);begin  if aRow = StringGrid1.Row then  begin  if aCol >= StringGrid1.FixedCols then      StringGrid1.Canvas.Brush.Color := clHighlight    else      StringGrid1.Canvas.Brush.Color := clBtnFace;  end else  if aRow < StringGrid1.FixedRows then    StringGrid1.Canvas.Brush.Color := clBtnFace  else  if aCol < StringGrid1.FixedCols then    StringGrid1.canvas.Brush.Color := clBtnFace  else    StringGrid1.Canvas.Brush.Color := clWindow;end; And you must invalidate the grid in the OnBeforeSelection event because the highlighted cells do not track correctly: 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.StringGrid1BeforeSelection(Sender: TObject; aCol, aRow: Integer  );begin  StringGrid1.Invalidate;end; ---------------------------------------------------------------------- ademir.uem · 2016-04-23 18:23 Thanks WB Anyway It does not make sense the why goRowSelect does not allow move  to the right when I use aRight. Why this work fine when I use external editor instead of In-place editor? It does not make sense. ---------------------------------------------------------------------- wp · 2016-04-23 18:37 Doesn't the attached demo do what you want? - highlight selected row ("faked rowselect") - editable cells - ENTER after edit advances active cell to the right, then to next row - TAB advances active cell to the right, then to next row I can't comment on your external editor since I don't know what you are doing there. ---------------------------------------------------------------------- ademir.uem · 2016-04-23 20:04 Your demo works but with a little visual problem. See the attached picture. Especially the column 2 (Nome) when I try edit. About my external editor,  replace by other, ie. SpinEdit, and I did this Procedure TFormMain.SpinEdit1KeyDown(Sender: TObject; var Key: Word;   Shift: TShiftState); begin   with StringGrid1 do begin     if Key in [9,13] then       EditorMode:=false;     if Col < ColCount then        Col := Col + 1     Else       Col := 0;     SetFocus;   end; end; ---------------------------------------------------------------------- wp · 2016-04-23 20:34 Quote from: ademir.uem on April 23, 2016, 10:04:56 pmYour demo works but with a little visual problem. See the attached picture. Especially the column 2 (Nome) when I try edit. What is the problem? Looks ok to me... ---------------------------------------------------------------------- ademir.uem · 2016-04-23 21:37 Take a look now. First with your suggestion, second with goRowSelect=true . Problem with canvas, but I do not know how to fix. ---------------------------------------------------------------------- wp · 2016-04-23 22:44 Try this: 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.StringGrid1PrepareCanvas(sender: TObject; aCol, aRow: Integer;  aState: TGridDrawState);begin  if aRow = StringGrid1.Row then  begin  if aCol = StringGrid1.Col then      StringGrid1.Canvas.Brush.Color := clWindow    else    if aCol >= StringGrid1.FixedCols then      StringGrid1.Canvas.Brush.Color := clHighlight    else      StringGrid1.Canvas.Brush.Color := clBtnFace;  end else  if aRow < StringGrid1.FixedRows then    StringGrid1.Canvas.Brush.Color := clBtnFace  else  if aCol < StringGrid1.FixedCols then    StringGrid1.canvas.Brush.Color := clBtnFace  else    StringGrid1.Canvas.Brush.Color := clWindow;end; ---------------------------------------------------------------------- ademir.uem · 2016-04-23 23:22 The same problem is repeted.  The problem is not the color, but how the select cell is painted. As you can see in my pictures, the cell under edition (selected) is not fulled painted with white color (above and below the text). ---------------------------------------------------------------------- wp · 2016-04-23 23:36 Sorry, I don't understand. It looks perfect to me - see screenshot (taken with Laz 1.6, using trunk the selected text is offset to the left which is not correct) [EDIT] I just uploaded a bugreport on cell editor placement in trunk. ---------------------------------------------------------------------- jesusr · 2016-04-24 01:54 Also don't forget that the grid has an option goRowHighlight