First, you must enable the goEditing option in Options of the StringGrid; Then, in the onKeyDown event, add the code (with ENTER ):
if key = 13 then
begin
if StringGrid.Col < (StringGrid.ColCount - 1) then StringGrid.Col := StringGrid.Col + 1
else
if StringGrid.Row < (StringGrid.RowCount -1) then
begin
StringGrid.Col:= StringGrid.FixedCols;
if StringGrid.Row < (StringGrid.RowCount -1) then StringGrid.Row := StringGrid.Row + 1
end
else Perform(WM_NEXTDLGCTL,0,0);
end;
To do with the arrow keys, use your ASC II codes:
37 (left arrow)
38 (up arrow)
39 (right arrow)
40 (down arrow)
Of course, to use with the arrow keys, improved logic will have to be applied, above is just the path to the stones.