I want to highlight specific row when I click on any cell in that row.
Just like selection background colour shows up over row when one clicks on the row label cell.
I setup binder for left mouse click:
And it doesn’t work, but if I comment out line event.Skip(), it works fine.
Well, not quite, because it disables editing the cell.
I understand that if I remove command event.Skip(), left mouse click event are erased from the event
stack and therefore will be impossible to “gather” two left click in the row, needed for detecting Dclick.
But I must admit that I don’t understand the behavior of the self.grid.SelectRow(event.GetRow(),False)
in that event handling setup. The same self.grid.SelectRow() command works fine out of the event
handler method.
Can you, please, help me to understand what is going on here?
I want to highlight specific row when I click on any cell in that row.
Just like selection background colour shows up over row when one clicks
on the row label cell.
I setup binder for left mouse click:
Did you also put the grid in row selection mode? Something like this:
self.SetSelectionMode(wx.grid.Grid.SelectRows)
And it doesn't work, but if I comment out line event.Skip(), it works fine.
Well, not quite, because it disables editing the cell.
Correct. You'll also disable anything else that is triggered by mouse clicks. So instead of hooking in at the mouse event level I would let the grid do all it wants with the mouse and do the row selection from the EVT_GRID_SELECT_CELL higher-level event instead.
I would still like to know were I did wrong, or why .SelectRow() doesn’t work with mouse event.
Where I can find a good (but not too expert) text about wxPython events
as a next step from the wxPython in Action (event part)?
Thanks again!
Neven
···
On Mon, Mar 1, 2010 at 10:04 PM, Robin Dunn robin@alldunn.com wrote:
On 2/28/10 2:04 PM, Neven Goršić wrote:
Dear all!
I want to highlight specific row when I click on any cell in that row.
Just like selection background colour shows up over row when one clicks
Did you also put the grid in row selection mode? Something like this:
self.SetSelectionMode(wx.grid.Grid.SelectRows)
And it doesn’t work, but if I comment out line event.Skip(), it works fine.
Well, not quite, because it disables editing the cell.
Correct. You’ll also disable anything else that is triggered by mouse clicks. So instead of hooking in at the mouse event level I would let the grid do all it wants with the mouse and do the row selection from the EVT_GRID_SELECT_CELL higher-level event instead.
On Mar 3, 4:22 am, Neven Goršić <neven.gor...@gmail.com> wrote:
Thank you - it WORKS!
I would still like to know were I did wrong, or why .SelectRow() doesn't
work with mouse event.
Where I can find a good (but not too expert) text about wxPython events
as a next step from the wxPython in Action (event part)?
Thanks again!
Neven
Do a search for "event" or "events" on the wxPython wiki. There are a
bunch of pages on the subject.
I can see blinking on these cells (right and up) for a second and than the cursor is set down instead of right by the grid automatism.
I want to use Ctrl key for deselecting rows from already selected group of rows. I see that grid provides Ctrl mechanism for appending selected new row to the existing group of selected rows. But holding Ctrl key and left klicking on some ALREADY selected row doesn’ deselect it as it should.
I tried:
Did you also put the grid in row selection mode? Something like this:
self.SetSelectionMode(wx.grid.Grid.SelectRows)
And it doesn’t work, but if I comment out line event.Skip(), it works fine.
Well, not quite, because it disables editing the cell.
Correct. You’ll also disable anything else that is triggered by mouse clicks. So instead of hooking in at the mouse event level I would let the grid do all it wants with the mouse and do the row selection from the EVT_GRID_SELECT_CELL higher-level event instead.
Sorry, I forgot to mention that we'll need more information to help with that. What exactly does "it doesn't work" mean? Can you provide a small runnable sample for people to experiment with?
···
On 3/10/10 10:45 PM, Neven Goršić wrote:
Thank you for showing me example for positioning grid cursor to the
right after editing.
But I still doesn't know how to solve second problem: deselecting
already selected rows by holding Ctrl key. Can you help me?