[Lazarus] TStringGrid.AutoEdit and options

Martin lazarus at mfriebe.de
Sun Jan 27 15:47:06 CET 2013

On 27/01/2013 14:23, Bart wrote:
> On 1/27/13, Martin <lazarus at mfriebe.de> wrote:
>> TStringGrid has:
>> - property AutoEdit:Boolean
>> - Options eoGoEdit
>> - Options eoAlwaysShowEditor
>> I figured some behavioural differences with the options.
>> But I can set AutoEdit True/False nothing changes. What does it do? Or
>> what Should it do?
> If Autoedit is False and goAlwaysShowEditor is not in Options, then
> clicking on a cell will not enable editing. If AutoEdit is True, then
> clicking on the cell will enable editing (goEditing must be in options
> of course).
> (Look at the code in TCustomGrid.MouseDown)
But if goEditing is set,

then I see no diff with AutoEdit or not?

In each case, the text caret appears, when I start typing
In each case the mouse sets the focus rect, but does not show the text caret

Oh, ok, found something: double click behaves different...

Is there a list of all the differences, for the 16 possible combinations:

- Single click on focused/unfucused cell
- Double click on focused/unfucused cell
- F12 once
- F12 twice
- paste
- Cursor left/right keys, when do they go to next cell, when not 
(depends on selection

in which mode, with which of the above, does the editor start with all 
or none of the text selected?

Does AutoAddRows behave different in any of the 16 modes?

Yes I can find out. But I am not planning to spend an hour or more on that

How does in behave with goRowSelect (multirow select allowed or not..)? 
I teseted a random setting, and found that cursor-right (not in the last 
cell of a row) will select the next row.

UNEXPECTED. when rowselect is used, and I edit a cell, and I wont to 
edit the cell in the next column (same row), and I press cursor right, 
at the end of the text in the cell that I am editing, I would expect to 
go to that next cell in the same line. But I end up one line below.

Of course if I pressed Shift-cursor right, then what should it do. The 
row is already selected, so Expanding selection would mean to include 
next row in selection.
But that is what shift down does. So maybe in that case shift right, 
should just end editing (if at end of text) and keep the selection on 
that row. (the selection can not be extended to the right!
And if row-select is off, then that is what shift cursor right does, add 
cells in the same row to the selection (select muliple cell), and do 
nothing if at the last column....


I am not sure that the behaviour is always well defined. Unless there is 
documentation, and the implementation tries to match that documentation.

> As to goEditing: it seems to act as ReadOnly does in other controls.
> If so (I might be wrong) then why not replace it with ReadOnly property?
Don't. It wil lbreak lfm reading.

More information about the Lazarus mailing list