Board index » delphi » Multiple row selection in TDBGrid

Multiple row selection in TDBGrid

The SelectedRows property contains a list of  entries which appear to
be of type TBookmarkStr, yet the Table.GotoBookmark method requires a
TBookmark as parameter. How does one use the TDBGrid.SelectedRows
property to determine which records have been selected?

Any help would be appreciated, thank you.

 

Re:Multiple row selection in TDBGrid


Quote
{*word*104}cat wrote:

> The SelectedRows property contains a list of  entries which appear to
> be of type TBookmarkStr, yet the Table.GotoBookmark method requires a
> TBookmark as parameter. How does one use the TDBGrid.SelectedRows
> property to determine which records have been selected?

> Any help would be appreciated, thank you.

Hi!

As I understand you need to access the selected records
(somethink like reading key field(s) values).
So you can
1. store current data set current position (store its Bookmark property)
2. disable all related controls,
3. loop through the grid's bookmark array and set data set bormark
   to locate correspondent record,
4. restore data set bookmark
5. Enable all related controls

I remember that I posted the similar message few days ago.

Sincerely,
        Eugene
-
#-----------------------------------------
# Name: Eugene V. Mishura            
# Location: Kiev, Ukraine
#-----------------------------------------
# Phone:        (+380 44) 4426077 (office)
#               (+380 44) 4437925 (office)
# E-Mail:       mish...@ksf.kiev.ua
#
#               NO SPAM, PLEASE
#
#-----------------------------------------

Re:Multiple row selection in TDBGrid


On Tue, 10 Feb 1998 14:44:34 +0200, "Eugene V. Mishura"

Quote
<mish...@ksf.kiev.ua> wrote:
>{*word*104}cat wrote:

>> The SelectedRows property contains a list of  entries which appear to
>> be of type TBookmarkStr, yet the Table.GotoBookmark method requires a
>> TBookmark as parameter. How does one use the TDBGrid.SelectedRows
>> property to determine which records have been selected?

>> Any help would be appreciated, thank you.

>As I understand you need to access the selected records
>(somethink like reading key field(s) values).
>So you can
>1. store current data set current position (store its Bookmark property)
>2. disable all related controls,
>3. loop through the grid's bookmark array and set data set bormark
>   to locate correspondent record,
>4. restore data set bookmark
>5. Enable all related controls

>I remember that I posted the similar message few days ago.

My question really concerned step 3.

Are you saying that each TBookmarkStr contains not a string, but an
array of Variants that I can use with the Locate method? (If so, I
wonder why Borland hasn't made it possible to simply use
GotoBookmark?)

Other Threads