When I right-click on a row in a grid, I want that row highlighted a certain color.
This is very similar to the post here in this group: link
but I could not figure out from their responses what the solution was 
As per the request of this group, I will attach a tiny, runnable piece of code that demonstrates the problem.
The right click event is being fired, but the row is not changing color.
Here is the right-click handler:
def handler_onRightClick(self, event):
print 'right click!'
row = event.GetRow()
#- Create the attr:
attr = gridlib.GridCellAttr()
attr.SetBackgroundColour('pink')
self.grid.SetSelectionMode(Grid.SelectRows)
#- Why doesn't this work:
self.grid.SetRowAttr(attr=attr, row=row)
self.grid.Refresh()
I’m attaching the entire, runable code to this message.
It’s driving me crazy, not being able to figure this out, considering everything else works like a champ.
Thanks!
foo.py (1.98 KB)
Hello Alexander,
i’ve attached a working version of your example. I commented out some unneeded lines of code. I hope this is of help for you.
foo_2.py (2.12 KB)
···
–
Torsten
Am Dienstag, 30. Juli 2013 05:03:17 UTC+2 schrieb Alexander Gray II:
When I right-click on a row in a grid, I want that row highlighted a certain color.
This is very similar to the post here in this group: link
but I could not figure out from their responses what the solution was 
As per the request of this group, I will attach a tiny, runnable piece of code that demonstrates the problem.
The right click event is being fired, but the row is not changing color.
Here is the right-click handler:
def handler_onRightClick(self, event):
print 'right click!'
row = event.GetRow()
#- Create the attr:
attr = gridlib.GridCellAttr()
attr.SetBackgroundColour('pink')
self.grid.SetSelectionMode(Grid.SelectRows)
#- Why doesn't this work:
self.grid.SetRowAttr(attr=attr, row=row)
self.grid.Refresh()
I’m attaching the entire, runable code to this message.
It’s driving me crazy, not being able to figure this out, considering everything else works like a champ.
Thanks!
My goodness, Torsten, it worked!
Thank you soooo much. That has been bugging me for ages!!!
Alex