From: Klaas Hartmann on
Hi there,

I am having problems GetSelected* on a wxGrid. I first noticed my problem in
wxPerl and thought it might be the wxPerl interface, however the samples/grid
example appears to have the same problem.

The environment:
Kubuntu 7.04
wxGTK-2.8.4 (built from scratch not package)
gcc version 4.1.2 (Ubuntu 4.1.2-0ubuntu4)

The behaviour I expect:
Suppose I have selected some cells in a wxGrid.
* In wxPerl calling any of the GetSelected* functions on that object should
return the selected cells.
* In the wxWidgets samples/grid the menu option "Select->Show Current
Selection" should show the selected cells in the text box at the bottom

What I get:
* In wxPerl nothing is returned from any of the functions
* In samples/grid I get "0 cells selected:" (or rows/columns if that selection
mode is used).

Am I expecting the wrong behaviour (seems unlikely given the samples/grid
example)? Or is my wxWidgets broken? Or is there a problem with wxGrid?

Thanks for your help!

Klaas


---------------------------------------------------------------------
To unsubscribe, e-mail: wx-users-unsubscribe(a)lists.wxwidgets.org
For additional commands, e-mail: wx-users-help(a)lists.wxwidgets.org

From: Klaas Hartmann on
Hello again,

I found some further information in bug reports 1443956 and 1217401. It turns
out you get different behaviour depending whether cells where selected by
clicking row/col labels or the cells. Below is a summary with behaviour by
selection mode.

In summary:
* I could not find a scenario where GetSelectedCells produced any output.
* When wxGridSelectRows/Cols is being used clicking on a cell in a row/col
produces the same behaviour (from a user's perspective) as does clicking on
the row/col label. Hence I expected that GetSelectedRows/Cols should also
behave in the same way.

Any thoughts on why this is implemented as it is? This implementation makes it
complicated/impossible? to get the selected cells by any means other than
events.

Thanks again!
Klaas


SelectionMode: wxGridSelectCells
-------------------------------------------
SELECT BY: CELLS ROW LABELS COL LABELS
wxGrid::GetSelectedCells x x x
wxGrid::GetSelectedCols x x y
wxGrid::GetSelectedRows x y x

SelectionMode: wxGridSelectRows
-------------------------------------------
SELECT BY: CELLS ROW LABELS COL LABELS
wxGrid::GetSelectedCells x x NA
wxGrid::GetSelectedCols x x NA
wxGrid::GetSelectedRows x y NA

SelectionMode: wxGridSelectCols
-------------------------------------------
SELECT BY: CELLS ROW LABELS COL LABELS
wxGrid::GetSelectedCells x NA x
wxGrid::GetSelectedCols x NA y
wxGrid::GetSelectedRows x NA x




On Wed, 11 Jul 2007 15:13:58 Klaas Hartmann wrote:
> Hi there,
>
> I am having problems GetSelected* on a wxGrid. I first noticed my problem
> in wxPerl and thought it might be the wxPerl interface, however the
> samples/grid example appears to have the same problem.
>
> The environment:
> Kubuntu 7.04
> wxGTK-2.8.4 (built from scratch not package)
> gcc version 4.1.2 (Ubuntu 4.1.2-0ubuntu4)
>
> The behaviour I expect:
> Suppose I have selected some cells in a wxGrid.
> * In wxPerl calling any of the GetSelected* functions on that object should
> return the selected cells.
> * In the wxWidgets samples/grid the menu option "Select->Show Current
> Selection" should show the selected cells in the text box at the bottom
>
> What I get:
> * In wxPerl nothing is returned from any of the functions
> * In samples/grid I get "0 cells selected:" (or rows/columns if that
> selection mode is used).
>
> Am I expecting the wrong behaviour (seems unlikely given the samples/grid
> example)? Or is my wxWidgets broken? Or is there a problem with wxGrid?
>
> Thanks for your help!
>
> Klaas
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wx-users-unsubscribe(a)lists.wxwidgets.org
> For additional commands, e-mail: wx-users-help(a)lists.wxwidgets.org



---------------------------------------------------------------------
To unsubscribe, e-mail: wx-users-unsubscribe(a)lists.wxwidgets.org
For additional commands, e-mail: wx-users-help(a)lists.wxwidgets.org

From: "John Labenski" on
Try wxGrid::GetSelectionBlockTopLeft and wxGrid::GetSelectionBlockBottomRight.

See :
http://www.wxwidgets.org/manuals/stable/wx_wxgrid.html#wxgridgetselectedcells

This is not a bug, the selection tries to minimize the amount of data
it has to store.

Regards,
John Labenski


On 7/11/07, Klaas Hartmann <k.hartmann(a)math.canterbury.ac.nz> wrote:
> Hello again,
>
> I found some further information in bug reports 1443956 and 1217401. It turns
> out you get different behaviour depending whether cells where selected by
> clicking row/col labels or the cells. Below is a summary with behaviour by
> selection mode.
>
> In summary:
> * I could not find a scenario where GetSelectedCells produced any output.
> * When wxGridSelectRows/Cols is being used clicking on a cell in a row/col
> produces the same behaviour (from a user's perspective) as does clicking on
> the row/col label. Hence I expected that GetSelectedRows/Cols should also
> behave in the same way.
>
> Any thoughts on why this is implemented as it is? This implementation makes it
> complicated/impossible? to get the selected cells by any means other than
> events.
>
> Thanks again!
> Klaas
>
>
> SelectionMode: wxGridSelectCells
> -------------------------------------------
> SELECT BY: CELLS ROW LABELS COL LABELS
> wxGrid::GetSelectedCells x x x
> wxGrid::GetSelectedCols x x y
> wxGrid::GetSelectedRows x y x
>
> SelectionMode: wxGridSelectRows
> -------------------------------------------
> SELECT BY: CELLS ROW LABELS COL LABELS
> wxGrid::GetSelectedCells x x NA
> wxGrid::GetSelectedCols x x NA
> wxGrid::GetSelectedRows x y NA
>
> SelectionMode: wxGridSelectCols
> -------------------------------------------
> SELECT BY: CELLS ROW LABELS COL LABELS
> wxGrid::GetSelectedCells x NA x
> wxGrid::GetSelectedCols x NA y
> wxGrid::GetSelectedRows x NA x
>
>
>
>
> On Wed, 11 Jul 2007 15:13:58 Klaas Hartmann wrote:
> > Hi there,
> >
> > I am having problems GetSelected* on a wxGrid. I first noticed my problem
> > in wxPerl and thought it might be the wxPerl interface, however the
> > samples/grid example appears to have the same problem.
> >
> > The environment:
> > Kubuntu 7.04
> > wxGTK-2.8.4 (built from scratch not package)
> > gcc version 4.1.2 (Ubuntu 4.1.2-0ubuntu4)
> >
> > The behaviour I expect:
> > Suppose I have selected some cells in a wxGrid.
> > * In wxPerl calling any of the GetSelected* functions on that object should
> > return the selected cells.
> > * In the wxWidgets samples/grid the menu option "Select->Show Current
> > Selection" should show the selected cells in the text box at the bottom
> >
> > What I get:
> > * In wxPerl nothing is returned from any of the functions
> > * In samples/grid I get "0 cells selected:" (or rows/columns if that
> > selection mode is used).
> >
> > Am I expecting the wrong behaviour (seems unlikely given the samples/grid
> > example)? Or is my wxWidgets broken? Or is there a problem with wxGrid?
> >
> > Thanks for your help!
> >
> > Klaas
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: wx-users-unsubscribe(a)lists.wxwidgets.org
> > For additional commands, e-mail: wx-users-help(a)lists.wxwidgets.org
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wx-users-unsubscribe(a)lists.wxwidgets.org
> For additional commands, e-mail: wx-users-help(a)lists.wxwidgets.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: wx-users-unsubscribe(a)lists.wxwidgets.org
For additional commands, e-mail: wx-users-help(a)lists.wxwidgets.org

From: Klaas Hartmann on
Hi John,

Okay after examining the source I get it now:
- GetSelectionBlock* is used for blocks that are selected (by dragging or
clicking a cell in wxGridSelectRows/wxGridSelectCols selection mode).
- GetSelectedCells works on individual cells selected (while holding ctrl)
- GetSelectedRows/Cols works on rows/columns selected by clicking the labels
in wxGridSelectRows/wxGridSelectCols selection mode).

This way there is no overlap between the selections returned using these
functions... I still think it might be useful to have GetSelectedRows/Cols
return the selection if a cell is clicked in
wxGridSelectRows/wxGridSelectCols selection mode -- you are selecting a
row/column after all.

Lastly, I think better documentation might be useful, particularly with
respect to the selection mode. Even after your email I still needed to
examine the source code to fully understand how this works.... Also it might
be useful if the grid sample displayed the output from all the GetSelected*
options when you use the "Show current Selection" menu option. This would
have explained things nicely.

Best wishes,
Klaas

On Wed, 11 Jul 2007 17:58:54 John Labenski wrote:
> Try wxGrid::GetSelectionBlockTopLeft and
> wxGrid::GetSelectionBlockBottomRight.
>
> See :
> http://www.wxwidgets.org/manuals/stable/wx_wxgrid.html#wxgridgetselectedcel
>ls
>
> This is not a bug, the selection tries to minimize the amount of data
> it has to store.
>
> Regards,
> John Labenski
>
> On 7/11/07, Klaas Hartmann <k.hartmann(a)math.canterbury.ac.nz> wrote:
> > Hello again,
> >
> > I found some further information in bug reports 1443956 and 1217401. It
> > turns out you get different behaviour depending whether cells where
> > selected by clicking row/col labels or the cells. Below is a summary with
> > behaviour by selection mode.
> >
> > In summary:
> > * I could not find a scenario where GetSelectedCells produced any output.
> > * When wxGridSelectRows/Cols is being used clicking on a cell in a
> > row/col produces the same behaviour (from a user's perspective) as does
> > clicking on the row/col label. Hence I expected that GetSelectedRows/Cols
> > should also behave in the same way.
> >
> > Any thoughts on why this is implemented as it is? This implementation
> > makes it complicated/impossible? to get the selected cells by any means
> > other than events.
> >
> > Thanks again!
> > Klaas
> >
> >
> > SelectionMode: wxGridSelectCells
> > -------------------------------------------
> > SELECT BY: CELLS ROW LABELS
> > COL LABELS wxGrid::GetSelectedCells x x
> > x wxGrid::GetSelectedCols x x
> > y wxGrid::GetSelectedRows x y
> > x
> >
> > SelectionMode: wxGridSelectRows
> > -------------------------------------------
> > SELECT BY: CELLS ROW LABELS
> > COL LABELS wxGrid::GetSelectedCells x x
> > NA wxGrid::GetSelectedCols x x
> > NA wxGrid::GetSelectedRows x y
> > NA
> >
> > SelectionMode: wxGridSelectCols
> > -------------------------------------------
> > SELECT BY: CELLS ROW LABELS
> > COL LABELS wxGrid::GetSelectedCells x NA
> > x wxGrid::GetSelectedCols x NA
> > y wxGrid::GetSelectedRows x NA
> > x
> >
> > On Wed, 11 Jul 2007 15:13:58 Klaas Hartmann wrote:
> > > Hi there,
> > >
> > > I am having problems GetSelected* on a wxGrid. I first noticed my
> > > problem in wxPerl and thought it might be the wxPerl interface, however
> > > the samples/grid example appears to have the same problem.
> > >
> > > The environment:
> > > Kubuntu 7.04
> > > wxGTK-2.8.4 (built from scratch not package)
> > > gcc version 4.1.2 (Ubuntu 4.1.2-0ubuntu4)
> > >
> > > The behaviour I expect:
> > > Suppose I have selected some cells in a wxGrid.
> > > * In wxPerl calling any of the GetSelected* functions on that object
> > > should return the selected cells.
> > > * In the wxWidgets samples/grid the menu option "Select->Show Current
> > > Selection" should show the selected cells in the text box at the bottom
> > >
> > > What I get:
> > > * In wxPerl nothing is returned from any of the functions
> > > * In samples/grid I get "0 cells selected:" (or rows/columns if that
> > > selection mode is used).
> > >
> > > Am I expecting the wrong behaviour (seems unlikely given the
> > > samples/grid example)? Or is my wxWidgets broken? Or is there a problem
> > > with wxGrid?
> > >
> > > Thanks for your help!
> > >
> > > Klaas
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: wx-users-unsubscribe(a)lists.wxwidgets.org
> > > For additional commands, e-mail: wx-users-help(a)lists.wxwidgets.org
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: wx-users-unsubscribe(a)lists.wxwidgets.org
> > For additional commands, e-mail: wx-users-help(a)lists.wxwidgets.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wx-users-unsubscribe(a)lists.wxwidgets.org
> For additional commands, e-mail: wx-users-help(a)lists.wxwidgets.org



---------------------------------------------------------------------
To unsubscribe, e-mail: wx-users-unsubscribe(a)lists.wxwidgets.org
For additional commands, e-mail: wx-users-help(a)lists.wxwidgets.org