set bool cell to checked

i have googled, looked in the demo's and on the website and no where can i see a solution to setting a bool grid cell to "checked". there must be a way to pragmaticly set the visual to a tick in that grid cell type.
what is especially frustrating is you can easily set it to unchecked. i've also attempted this on 2.6.1 with no success.

Paul McNett wrote:

Timothy Smith wrote:

i have googled, looked in the demo's and on the website and no where can i see a solution to setting a bool grid cell to "checked". there must be a way to pragmaticly set the visual to a tick in that grid cell type.
what is especially frustrating is you can easily set it to unchecked. i've also attempted this on 2.6.1 with no success.

i have found a way but it's not pretty, i set the value in the table object to 1, instead of using SetCellValue.

Good, that's how the data table is supposed to work. Set the values there, and the grid will query them when needed.

i almost have my grid cells behaving in a more sane manner, but ever now i need to trigger an event, since setting the cell value in this way doesn't trigger a cell change event.
how do i manually send an event like this?

What about grid.Refresh()?

nope that won't send the events. i need to get it to send a cell_changed event, manually if need be.

Paul McNett wrote:

Timothy Smith wrote:

Paul McNett wrote:

Timothy Smith wrote:
What about grid.Refresh()?

nope that won't send the events. i need to get it to send a cell_changed event, manually if need be.

If the value in the data table has changed, doing grid.Refresh() will force the grid to discover that it is different and update the display of it accordingly.

below is my code. as it is it works exactly how i want. when you click on the grid cell it checks the box without having to mess around clicking 2 or 3 times (users found this extremely annoying) however self.Refresh() does not trigger events.

events.eventManager.Register(self.CheckAvailable,wx.grid.EVT_GRID_CELL_CHANGE,self)
        events.eventManager.Register(self.OnLeftClick,wx.grid.EVT_GRID_CELL_LEFT_CLICK,self)
        events.eventManager.Register(self.OnLeftClick,wx.grid.EVT_GRID_CELL_LEFT_DCLICK,self)
        events.eventManager.Register(self.SaveCheck,wx.grid.EVT_GRID_EDITOR_CREATED,self)
           def SaveCheck(self,event):
        """This will save the check as soon as it's made"""
        self.SaveEditControlValue()
           def OnLeftClick( self, event ):
        self.table.data[event.GetRow()][event.GetCol()] = 1
        self.Refresh()
        event.Skip()
        return
           def CheckAvailable(self,event):
       """this performs some actions"""

Timothy Smith wrote:

What I did in Dabo, along with making a better looking book renderer, is to activate the editor upon grid cell selection. This makes the editor have focus and you don't need multiple clicks to check/uncheck the value.

how do you activate an editor without the click but?

I stand corrected. I just tested it and the first click activates the cell, which activates the editor. The second click toggles the checkbox. I seem to remember there being something you can send to the editor's __init__ to send a click through, I'll check that out at some point.

But as far as using the keyboard to navigate, Dabo's grid behaves well: arrow key to the bool cell, editor activates. Spacebar toggles. Works how the user would expect.

ยทยทยท

--
Paul McNett
http://paulmcnett.com
http://dabodev.com