(0.1) The second column disappears
I found a bug in the column count calculation if the grid's AutoExpand flags do not contain the flag aeDefault. I hope the fix has no sideeffects because I had to touch this location already several times...
BTW, there's another bug in your code:
procedure TBeheer1ItemForm.FormCreate(Sender: TObject);
begin
...
WriteColWidth(0,30,suChars);
WriteColWidth(1,30,suChars); // <--- 1st parameter must be 1 instead of 0
(0.2) Clicking in the celledit makes the contents of the cell in the grid disappear. Excel keeps the characters in the grid and in the celledit in synch. I would not go that far, but it would be preferred if the content of the grid stays intact until editing of the celledit is done.
I don't quite understand... When you click into a cell and open the cell editor, all the cell content is selected, it should not disappear in this state - I've never seen this. However, it is standard behavior of the Lazarus (and Delphi) Edit controls that the first character entered replaces the edit text if the entire text is selected. If users don't want to overwrite the current cell content, but, e.g. only add some characters, they should press the right arrow key - this unselects the edit text and moves the cursor to the end of the text
(03) Setting WantReturns on the celledit makes that entering Return finishes editing and jumps to another cell. Ctr-Enter is needed to insert a line break. Shouldn't this be the other way around (as the api says)?
Which api?
In Excel (and in the Lazarus StringGrid), if you press ENTER the active cell moves either horizontally or vetically; in the Lazarus StringGrid the direction can be defined by the AutoAdvance property (also in Excel, somewhere in its settings). The WorksheetGrid has an intermediate step opening the cell editor, i.e. you need ENTER twice to advance to the next cell.
In Excel the special key to add an manual line break into a cell text is ALT+ENTER. This is different in the Lazarus grid where CTRL+ENTER is needed.
(3) Indeed the entire grid can be disabled for user editing. But I am interested in disabling individual cells. End-users are only allowed write access to part of the information in the grid. Now I solve this by an On Validate event handler, setting NewValue := OldValue for the protected cells.
As I wrote in the previous post I would not do it like that because cell protection is built into the worksheet and is respected by the grid. The concept is maybe a bit difficult to understand, but Excel and LibreOffice Calc do it in the same way: At first you lock the entire worksheet, then you unlock those cells which users are allowed to edit. This is much more efficient than the opposite case of keeping the sheet unlocked and locking the readonly cells because then the user still can enter data in empty cells which don't have a data record to store the "locked" information.
(4) The event handler GridEditingDone in Beheer1Item does an UpdateRowHeights for each row. It has no effect. This seems consistent with your explanation in (0).
Sure. But you must remove this event handler because it will make the row heights shrink to the height of the text entered. If you want this then you still don't need an event handler because the grid will shrink the row height automatically. But you must remove the WriteRowHeight(i,20,suMillimeters) in this case because this forces the row height to the specified value, regardless of whether there is cell content or not, and regardless of the text height in the cells.