[Gambas-user] Gridview multiple select... how to read each selected row?

Benoit Minisini gambas at ...1...
Tue Apr 15 02:13:47 CEST 2008


On lundi 14 avril 2008, Stephen Bungay wrote:
> Hi Lee;
>     I never did understand why the grid control would allow you to
> select multiple items and not have a mechanism to indicate which rows
> were selected and which were not. Perhaps it does have such a mechanism
> but I haven't been able to find it. Of course it could be deeply buried
> but then thats a bad thing too.
>    Anyway, what you can probably do is create a collection that holds
> each selected item's row number, use the row number as the index into
> the collection. Each time the select event is raised by the control,
> trap it and store the row that was clicked on in the collection. If you
> get an error when trying to add the row number to the collection because
> the index key already exists then you know the row was already stored
> and the user has clicked on a row to deselected it. Remove that row from
> the collection, thus keeping the information in the collection in sync
> with the selected rows in the grid.
>    IMHO this is a kludge to accommodate the grid control which should
> have a mechanism that exposes the selected state of it's row items to
> the programmer.
>
> Steve.
>

At the moment, you have to test the Selected property of each row to get the 
selection.

I admit that the process is not optimal! Maybe I should add a Selection 
property that would return the indexes of all selected rows?

-- 
Benoit Minisini




More information about the User mailing list