Sign in Join

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

Mailing lists / lazarus / 2008-07

TDbGrid and multiselect

7 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

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

Luca Olivetti

Under delphi 2, in a dbgrid with multiselect (and rowselect), the current row is part of the selection, and the selection is extended with shift+arrows up/down, as well as with ctrl+click.
Under lazarus (svn 15358), the current row isn't part of the selection and shift+arrows doesn't extend the selection, only ctrl+click select multiple rows.
Is that because newer delphi version are doing it differently than delphi 2 or is it just an oversight?
Does TRxDbGrid work the same? (I guess I'll try it, but if someone can tell me beforehand I'll avoid it if it works just like TDbGrid)

Bye

Luca Olivetti Wetron Automatizaci?n S.A. http://www.wetron.es/ Tel. +34 93 5883004 Fax +34 93 5883007

Reply by email

Luca Olivetti
to Luca Olivetti

En/na Luca Olivetti ha escrit:

Show quoted text 10 lines
Under delphi 2, in a dbgrid with multiselect (and rowselect), the current row is part of the selection, and the selection is extended with shift+arrows up/down, as well as with ctrl+click. Under lazarus (svn 15358), the current row isn't part of the selection and shift+arrows doesn't extend the selection, only ctrl+click select multiple rows. Is that because newer delphi version are doing it differently than delphi 2 or is it just an oversight? Does TRxDbGrid work the same? (I guess I'll try it, but if someone can tell me beforehand I'll avoid it if it works just like TDbGrid)

Ok, I tried it and it does the same (unsurprisingly since it derives from TCustomDBGrid and almost doesn't touch SelectedRows) :-(

Bye

Luca Olivetti Wetron Automatizaci?n S.A. http://www.wetron.es/ Tel. +34 93 5883004 Fax +34 93 5883007

Reply by email

Luca Olivetti
to Luca Olivetti

En/na Luca Olivetti ha escrit:

Show quoted text 15 lines
En/na Luca Olivetti ha escrit: > Under delphi 2, in a dbgrid with multiselect (and rowselect), the > current row is part of the selection, and the selection is extended with > shift+arrows up/down, as well as with ctrl+click. > Under lazarus (svn 15358), the current row isn't part of the selection > and shift+arrows doesn't extend the selection, only ctrl+click select > multiple rows. > Is that because newer delphi version are doing it differently than > delphi 2 or is it just an oversight? > Does TRxDbGrid work the same? (I guess I'll try it, but if someone can > tell me beforehand I'll avoid it if it works just like TDbGrid) Ok, I tried it and it does the same (unsurprisingly since it derives from TCustomDBGrid and almost doesn't touch SelectedRows) :-(

Another difference: under delphi, selecting a row (without shift or ctrl) deselects the previous selection, this isn't so under lazarus, where the only way to deselect a row is to explicitly ctrl+click over it.

Bye

Luca Olivetti Wetron Automatizaci?n S.A. http://www.wetron.es/ Tel. +34 93 5883004 Fax +34 93 5883007

Reply by email

Jesus Reyes
to Luca Olivetti

--- El lun 7-jul-08, Luca Olivetti escribi?:

Show quoted text 42 lines
De:: Luca Olivetti Asunto: Re: [Lazarus] TDbGrid and multiselect A: "General mailing list" Fecha: lunes, 7 julio, 2008, 3:13 am En/na Luca Olivetti ha escrit: > En/na Luca Olivetti ha escrit: >> Under delphi 2, in a dbgrid with multiselect (and rowselect), the >> current row is part of the selection, and the selection is extended with >> shift+arrows up/down, as well as with ctrl+click. >> Under lazarus (svn 15358), the current row isn't part of the selection >> and shift+arrows doesn't extend the selection, only ctrl+click select >> multiple rows. >> Is that because newer delphi version are doing it differently than >> delphi 2 or is it just an oversight? >> Does TRxDbGrid work the same? (I guess I'll try it, but if someone can >> tell me beforehand I'll avoid it if it works just like TDbGrid) > > Ok, I tried it and it does the same (unsurprisingly since it derives > from TCustomDBGrid and almost doesn't touch SelectedRows) > :-( Another difference: under delphi, selecting a row (without shift or ctrl) deselects the previous selection, this isn't so under lazarus, where the only way to deselect a row is to explicitly ctrl+click over it. Bye -- Luca Olivetti Wetron Automatizaci?n S.A. http://www.wetron.es/ Tel. +34 93 5883004 Fax +34 93 588300

It looked to me useful to have persistent selection where you can browse with mouse or keyboard to other section of dataset. Because SelectedRows if public it just need a dbgrid.SelectedRows.Clear operation after processing the selected rows. But I think we can make this delphi compatible if you or somebody provides a spec for this feature.

Jesus Reyes A.

__________________________________________________ Correo Yahoo!
Espacio para todos tus mensajes, antivirus y antispam ?gratis! Reg?strate ya - http://correo.yahoo.com.mx/

Reply by email

Luca Olivetti
to Jesus Reyes

En/na Jesus Reyes ha escrit:

It looked to me useful to have persistent selection where you can browse with mouse or keyboard to other section of dataset. Because SelectedRows if public it just need a dbgrid.SelectedRows.Clear operation after processing the selected rows. But I think we can make this delphi compatible if you or somebody provides a spec for this feature.

I can only say what my ancient version of delphi does:

1) the current row is part of the selection (e.g. if I used TRxDbGrid it has both the triangle and the dot, and SelectedRows.count is 1) (under Lazarus SelectedRows.count is 0)

2) shift-click extends the selection from the previously selected row to the new one (under lazarus shift click is no different than plain click)

3) ctrl-click add the new clicked row to the selection (this works the same under lazarus)

4) shift-arrow up or shift-arrow down extends the selection one row at a time (or remove it if you go the opposite way) (under lazarus there's no difference between arrows with or without shift)

5) selecting a row without shift or control clears the selection (well, actually it reduces it to the current row, see 1) (under lazarus the selection is untouched)

It's quite similar to what a TStringGrid currently does under lazarus when you activate RangeSelect, but you can also select non-contiguous rows with ctrl-click.

I can work-around 1) in my code (but then my code will break if TDbGrid is made delphi compatible) and the rest in the documentation (those that will be using the new program are used to the delphi behavior, so I'll have to explain to them that this program behaves differently).

Bye

Luca Olivetti Wetron Automatizaci?n S.A. http://www.wetron.es/ Tel. +34 93 5883004 Fax +34 93 5883007

Reply by email

Jesus Reyes
to Luca Olivetti

--- El lun 7-jul-08, Luca Olivetti escribi?:

Show quoted text 8 lines
I can only say what my ancient version of delphi does: 1) the current row is part of the selection (e.g. if I used TRxDbGrid it has both the triangle and the dot, and SelectedRows.count is 1) (under Lazarus SelectedRows.count is 0)

Done.

Show quoted text 5 lines
2) shift-click extends the selection from the previously selected row to the new one (under lazarus shift click is no different than plain click)

Can't do or will be TODO a dbgrid it's not a Listbox, are you sure delphi can do this?

3) ctrl-click add the new clicked row to the selection (this works the same under lazarus)

Currently it's more like Toggle, if it is selected it's removed from selection, if it is not selected it's added to selection.

Show quoted text 6 lines
4) shift-arrow up or shift-arrow down extends the selection one row at a time (or remove it if you go the opposite way) (under lazarus there's no difference between arrows with or without shift)

Done.

Show quoted text 6 lines
5) selecting a row without shift or control clears the selection (well, actually it reduces it to the current row, see 1) (under lazarus the selection is untouched)

Done.

Show quoted text 8 lines
I can work-around 1) in my code (but then my code will break if TDbGrid is made delphi compatible) and the rest in the documentation (those that will be using the new program are used to the delphi behavior, so I'll have to explain to them that this program behaves differently).

please test r15713

Bye -- Luca Olivetti

Jesus Reyes A.

__________________________________________________ Correo Yahoo!
Espacio para todos tus mensajes, antivirus y antispam ?gratis! Reg?strate ya - http://correo.yahoo.com.mx/

Reply by email

Luca Olivetti
to Jesus Reyes

En/na Jesus Reyes ha escrit:

Show quoted text 6 lines
> 2) shift-click extends the selection from the previously > selected row to > the new one (under lazarus shift click is no different than > plain click) Can't do or will be TODO a dbgrid it's not a Listbox, are you sure delphi can do this?

You're right, it cannot.

please test r15713

Works like a charm, thank you.

Bye

Luca Olivetti Wetron Automatizaci?n S.A. http://www.wetron.es/ Tel. +34 93 5883004 Fax +34 93 5883007

Reply by email