From: Karl K. <kar...@ut...> - 2008-05-19 22:55:09
|
On Sun, 18 May 2008, Jason Harthun wrote: > Hi. I need some help with the Grid component. > > Here is the code that I'm working with: > > # ... > def on_grdDataGrid_selectCell(self, event): > self.components.grdDataGrid.EnableEditing(False) > event.skip() > > def on_grdDataGrid_keyDown(self, event): > self.components.grdDataGrid.EnableEditing(False) > event.skip() > # ... > def on_grdDataGrid_editorHidden(self, event): > result = dialog.messageDialog(self, "Are you sure you wish to save the changes?","Save", wx.YES_NO) > if not result.accepted: > event.Veto() > return > event.skip() > > > I would like to allow editing only if the user double clicks in the > cell. After editing a cell and using enter or tab to exit the cell, the > dialog associated with the editorHidden event pops up twice. I only > want it to pop up once. Any help would be appreciated. Thanks. IIRC there is a debugger for this, but my guess is that when the new cell is entered, it receives one of the cell selection events, while the old cell also gets a key down event. Possible solution: check if the editing was already disabled before making the EnableEditing call. Possible design enhancement: make an editing_enabled property for the grid instead (such that the setter only makes the state-change - implicitly triggering the event - when the set state is not the existing state). Karl Knechtel {:> |