I have a very similar problem. Currently, I use a nested function with a
"for loop" to grab a row of data from the grid. I've tried selecting
columns/rows programatically using SelectCol or SelectRow and then using
the GetSelectedCells() method, but it always returns an empty list. I'm
not sure what Robin means, but then again, I'm an amateur and he's the
creator of the toolkit.
The wxGrid selection API is fairly complicated - there are in fact 4
different types of selection. There is full row selection, full column
selection, rectangular selection, and individual cell selection. These
correspond to the APIs GetSelectedRows, GetSelectedCols,
GetSelectionBlockTopLeft/BottomRight, and GetSelectedCells. As you can
see, if you select a full row using SelectRow(), it doesn't show up in
GetSelectedCells. On the other hand, if you manually click each cell
(using ctrl-click to add to the selection), GetSelectedRows() will be
empty and they will all be in GetSelectedCells. So you can see it can
get pretty complicated.
Chris,
> From: Chris Mellon [mailto:arkanes@gmail.com]
> Sent: Thursday, August 30, 2007 8:54 AM
> To: wxPython-users@lists.wxwidgets.org
> Subject: Re: [wxPython-users] Grid Selection (Was: Two More
> Grid Questions)
>
<snip>
>
> The wxGrid selection API is fairly complicated - there are in
> fact 4 different types of selection. There is full row
> selection, full column selection, rectangular selection, and
> individual cell selection. These correspond to the APIs
> GetSelectedRows, GetSelectedCols,
> GetSelectionBlockTopLeft/BottomRight, and GetSelectedCells.
> As you can see, if you select a full row using SelectRow(),
> it doesn't show up in GetSelectedCells. On the other hand, if
> you manually click each cell (using ctrl-click to add to the
> selection), GetSelectedRows() will be empty and they will all
> be in GetSelectedCells. So you can see it can get pretty complicated.
>
Yeah, I noticed that behavior. I also read the very brief descriptions
about all those methods in WIA, but I guess I don't get it. So, you can't
use SelectCol or SelectRow to select a set of cells and then return their
values with GetSelectedCells, but you can get the values returned with
GetSelectedRows?
You don't get *values* from any of these APIs. They return what things
are selected, not the values of the cells.
ยทยทยท
On 8/30/07, Mike Driscoll <mdriscoll@co.marshall.ia.us> wrote:
> -----Original Message-----
I must have missed something. That only returns the row number, not the
individual values in the cells of the row. I understand it's pretty
complicated, otherwise the Book wouldn't have an entire chapter on only
one widget.
Mike