[Lazarus] How to programmaticaly move editor in TStringGrid?

Donald Ziesig donald at ziesig.org
Wed Mar 25 03:43:43 CET 2015

Hi All!

I am having a problem with a TStringGrid.  Many years ago, IIRC I used 
Delphi 1's (I said it was many years ago :-D ) string grid and was able 
to programatically move the editor to any (non-fixed) cell.  The editor 
followed the selected cell.   I have been trying to get this to work in 
Lazarus for several days and the best I can do is get the selected cell 
to change under program control (the highlight follows the selection), 
but the editor always stays on the cell that was last selected by the 
mouse (the editor's border does not move, and keystrokes change the 
original mouse-selected cell).  This results in a confusing situation 
where both the editor and selection are shown in different cells.  When 
the selected cell and the editor cell match, the selection highlight 

I have tried innumerable (well almost) combinations of properties, 
options, hacks (even tried to fake it out by sending mouse event 
messages to the string grid) but I can't make the darned editor move 
except with the mouse (or <Enter> key).

Using Lazarus 1.2.6, FPC 2.6.4 on Linux Mint 17.  I haven't tried it on 
windows yet (that is on my agenda for tomorrow).

Has anyone encountered this problem and found a way of moving the editor 
with code?

Help will be greatly appreciated.


Don Ziesig

P.S.,  I also have a minor annoyance:  AutoAdvance, which the Docs say 
is activated by Mouse Clicks and Tabs, only advances when the <Enter> 
key is pressed.  I can live with that, but I always hit the <Tab> key 
first ;-) .

More information about the Lazarus mailing list