Making string grids editable by users.
If you create a TStringGrid object on your form, it is by default meant to display data (fill-in of its content under Lazarus or doing so from the application).
The user can select text in the grid, but can't write any data to it. What now, if you need an application, where the grid's content has to be entered by the
user, or where the user should have direct access to the grid to modify the cell values?
String grids have no ReadOnly property, but are highly configurable by setting the different items of the Options property. To make a string grid directly editable to users, just set goEditing = True. That's it! For user convenience, you may want also set goTabs = True, what gives the user the possibility to navigate from grid field to grid field by using the TAB key. Note, that fixed cells are always readonly. Thus, if you want the user to enter the grid's title (or other header information), you must set FixedRows = 0. On the other side, you can protect the data of given columns to be overwritten by the user by setting FixedCols = n, with n > 0. This protection will, of course, only be possible for the n leftmost columns of the grid.
If you find this text helpful, please, support me and this website by signing my guestbook.