Moving cells in grid - explanation unclear lazarus / 31-LCL ---------------------------------------------------------------------- BigChimp · 2012-12-16 13:05 Hi, I'm trying to convert Delphi code that uses MoveColRow to go to a cell in a grid. Looking here: http://wiki.lazarus.freepascal.org/Grids_Reference_Page#Grid.27s_cell_ selection and in the help I see a description of what happens when changing/trying to change the currently selected cell. However, it does not show how to do it. I assume one should just use SelectCell, so that text can be changed from QuoteThe location of a grid's current (focused) cell (or row) can be changed using keyboard, mouse or through code. In order to change cell focus successfully to another position, we must test the target position to see if it is allowed to receive cell focus. When using keyboard, the property AutoAdvance performs part of the process by finding what should be the next focused cell. When using mouse clicks or moving by code, focus will not move from the current cell unless the target cell is permitted to receive focus. to: QuoteThe location of a grid's current (focused) cell (or row) can be changed using keyboard, mouse or through code. In order to change cell focus successfully to another position, we must test the target position to see if it is allowed to receive cell focus. When using the keyboard, the property AutoAdvance performs part of the process by finding what should be the next focused cell. When using mouse clicks or moving by code (e.g. using SelectCell), focus will not move from the current cell unless the target cell is permitted to receive focus. ---------------------------------------------------------------------- Blaazen · 2012-12-16 13:46 QuoteI'm trying to convert Delphi code that uses MoveColRow to go to a cell in a grid. MoveColRow is not a method to go to a cell in Grid. It is a method to move Column/Row and all its content from FromIndex to ToIndex. My experience is that it has nothing to do with AutoAdvance (not sure about SelectCell, but my quick test shows that OnSelectCell event is not raised during MoveColRow, even if focused position has changed). EDIT: I added a simple test. You don't have to press button, just run it. ---------------------------------------------------------------------- Bart · 2012-12-16 14:22 Quote from: BigChimp on December 16, 2012, 02:05:35 pmI'm trying to convert Delphi code that uses MoveColRow to go to a cell in a grid. Maybe I'm to simple but wouldn't just this do that: Code: [Select]  StringGrid1.Row := MyRow;   StringGrid1.Col := MyCol; Bart ---------------------------------------------------------------------- BigChimp · 2012-12-16 15:16 Thanks guys. @Bart: well yes, it might do that. I'm perhaps being too complicated again