Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2013-01

TStringGrid.AutoEdit and options

10 messages · 5 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Martin

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?

Laz 1.1 SVN from 26th Jan / fpc 2.6.0 / Win Vista 32 bit

Reply by email

Martin
to Martin
Martin wrote 13 lines
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? Laz 1.1 SVN from 26th Jan / fpc 2.6.0 / Win Vista 32 bit

There also is a none public property FastEditing: Boolean

So there are 16 different settings. How to they all differ?

Reply by email

Bart
to Martin: TStringGrid has: - property AutoEdit:Boolean - Options eoGoEdit - Options…
Martin wrote 9 lines
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)

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?

Bart

Reply by email

Martin
to Bart
Bart wrote 15 lines
On 1/27/13, Martin 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.

Reply by email

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

I had the same impression when using the stringgrid. Lots of features, but seemingly historically grown...

> 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.

Just let ReadOnly getter/setter include/exclude goEditing ? I believe it is so in several Delphi grids ? (but would need to check).

Michael.

Reply by email

zeljko
to Michael Van Canneyt
Michael Van Canneyt wrote 13 lines
On Sun, 27 Jan 2013, Martin wrote: > I am not sure that the behaviour is always well defined. Unless there is > documentation, and the implementation tries to match that documentation. I had the same impression when using the stringgrid. Lots of features, but seemingly historically grown... >> 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. Just let ReadOnly getter/setter include/exclude goEditing ?

No there's no ReadOnly (afair from D7 and K3). Besides goEditing there's also goAlwaysShowEditor, so how do to handle ReadOnly property with goEditing and goAlwaysShowEditor.

I believe it is so in several Delphi grids ? (but would need to check).

But why look into Delphi grids when our TStringGrid is not compatibile with Delphi one :) (missing TInplaceEditor, missing a lot of routines). My proposal (no need to hurry with this :) ) write TStringGrid from stratch (using current implementation mostly) to be 100% compatibile with Delphi (and it can be since it's TCustomControl ... we'll in Delphi it's TWinControl + it's own grid scrollbars, but under LCL we can do the same thing if needed) then create TLazStringGrid with current lazarus features and complications. OR add TInplaceEditor to current implementation and missing routines (I'll be glad to do that, but no spare time).

zeljko

Reply by email

Bart
to zeljko
zeljko wrote 14 lines
But why look into Delphi grids when our TStringGrid is not compatibile with Delphi one :) (missing TInplaceEditor, missing a lot of routines). My proposal (no need to hurry with this :) ) write TStringGrid from stratch (using current implementation mostly) to be 100% compatibile with Delphi (and it can be since it's TCustomControl ... we'll in Delphi it's TWinControl + it's own grid scrollbars, but under LCL we can do the same thing if needed) then create TLazStringGrid with current lazarus features and complications. OR add TInplaceEditor to current implementation and missing routines (I'll be glad to do that, but no spare time).

I don't have a recent delphi, but from what I gather at the dutch delphi forum, it seems that lazarus' stringgrid has more (usefull) features than delphi's one.
(It certainly is at least 1000 times better than the one in D3)

Bart

Reply by email

Jesus Reyes
to Martin: There also is a none public property FastEditing: Boolean So there are 16 different…

--- El dom 27-ene-13, Martin escribi?:

Show quoted text 25 lines
De: Martin Asunto: Re: [Lazarus] TStringGrid.AutoEdit and options A: "Lazarus mailing list" Fecha: domingo, 27 de enero de 2013, 5:54 On 27/01/2013 11:50, Martin 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? > > > Laz 1.1 SVN from 26th Jan / fpc 2.6.0 / Win Vista 32 bit > There also is a none public property FastEditing: Boolean So there are 16 different settings. How to they all differ?

goEditing: makes the grid editable or not (some will say it's equivalent to a readonly property)

goAlwaysShowEditor: if the grid is editable as its name say it will make the editor always visible, no effect if the grid is not editable.

as for AutoEdit, normally if the grid is editable clicking a selected cell will popup the cell editor, that's for AutoEdit=true and is what delphi stringgrid does, if you set AutoEdit=false editor will not pop up on clicking a selected cell, I forgot the reason this was added but as the Lazarus stringgrid allows range selection on editable grids, this may help in this case.

Jesus Reyes A.

Reply by email

Martin
to Jesus Reyes
Jesus Reyes wrote 26 lines
--- El dom 27-ene-13, Martin escribi?: > De: Martin > Asunto: Re: [Lazarus] TStringGrid.AutoEdit and options > A: "Lazarus mailing list" > Fecha: domingo, 27 de enero de 2013, 5:54 > On 27/01/2013 11:50, Martin 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? >> >> >> Laz 1.1 SVN from 26th Jan / fpc 2.6.0 / Win Vista 32 > bit > There also is a none public property FastEditing: Boolean > > So there are 16 different settings. How to they all differ? goEditing: makes the grid editable or not (some will say it's equivalent to a readonly property)

ok, so that is the main option, that must be set , or all others do nothing. (was my guess)

goAlwaysShowEditor: if the grid is editable as its name say it will make the editor always visible, no effect if the grid is not editable.
that one is obvious too, and seems to be prioritized over "AutoEdit" :=
False
as for AutoEdit, normally if the grid is editable clicking a selected cell will popup the cell editor, that's for AutoEdit=true and is what delphi stringgrid does, if you set AutoEdit=false editor will not pop up on clicking a selected cell, I forgot the reason this was added but as the Lazarus stringgrid allows range selection on editable grids, this may help in this case.

Ok, that one was not easy to figure. thanks.

-----
See the bug report on how those settings have side effects on the cursor keys....

http://bugs.freepascal.org/view.php?id=23756#c65213

except with eoAlwaysShowEditor and a selection of the first 3 of 5 chars, cursor right stays in the cell, while cursor left goes to neighbour cell. (without eoAlwaysShowEditor both cursor keys change cell)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20130127/4a38fa9e/attachment.html>

Reply by email

zeljko
to Bart: I don't have a recent delphi, but from what I gather at the dutch delphi forum, it seems…
Bart wrote 23 lines
On 1/27/13, zeljko wrote: > But why look into Delphi grids when our TStringGrid is not compatibile > with > > Delphi one :) (missing TInplaceEditor, missing a lot of routines). > My proposal (no need to hurry with this :) ) write TStringGrid from > stratch > > (using current implementation mostly) to be 100% compatibile with Delphi > (and > it can be since it's TCustomControl ... we'll in Delphi it's TWinControl > + it's own grid scrollbars, but under LCL we can do the same thing if > needed) > > then create TLazStringGrid with current lazarus features and > complications. OR add TInplaceEditor to current implementation and > missing routines (I'll be > glad to do that, but no spare time). I don't have a recent delphi, but from what I gather at the dutch delphi forum, it seems that lazarus' stringgrid has more (usefull) features than delphi's one. (It certainly is at least 1000 times better than the one in D3)

It is, I've just said that it is not delphi compatibile in many ways - nothing else.

Reply by email