Robin Dunn wrote:
> Niki Spahiev wrote:
>
>> This small idea enhances user experience with wxGrid:
>>
>> class Grid(wxGrid):
>>
>> def __init__(*arg,**kw):
>> wxGrid.__init__( *arg,**kw )
>> self = arg[0]
>> EVT_GRID_EDITOR_CREATED(self, self.OnEditorCreated)
>>
>> def OnEditorCreated( self, event ):
>> eh = wxEvtHandler()
>> eh.Connect(-1, -1, wxEVT_KILL_FOCUS,self.HandleControlKillFocus)
>> w = event.GetControl()
>> w.PushEventHandler( eh )
>> event.Skip()
>>
>> def HandleControlKillFocus( self, event ):
>> self.DisableCellEditControl()
>> event.Skip()
>>
>> When user leaves edit control for whatever reason it is automaticaly
>> closed.
>>
>> Is it worth for inclusion in wxWindows?
>>
>
> Perhaps as a MixIn. See wxPython.liib.mixins.grid.
>
I noted that after using it i got many leaks of wxGridCellEditorEvtHandler
Checking source found that grid conditionaly pushes such object and at
end unconditionaly pops one. Apparently it pops my handler. Should i put
these functions into C++ code to avoid leaks?
Robin Dunn wrote:
> Niki Spahiev wrote:
>
>> This small idea enhances user experience with wxGrid:
>>
>> class Grid(wxGrid):
>>
>> def __init__(*arg,**kw):
>> wxGrid.__init__( *arg,**kw )
>> self = arg[0]
>> EVT_GRID_EDITOR_CREATED(self, self.OnEditorCreated)
>>
>> def OnEditorCreated( self, event ):
>> eh = wxEvtHandler()
>> eh.Connect(-1, -1, wxEVT_KILL_FOCUS,self.HandleControlKillFocus)
>> w = event.GetControl()
>> w.PushEventHandler( eh )
>> event.Skip()
>>
>> def HandleControlKillFocus( self, event ):
>> self.DisableCellEditControl()
>> event.Skip()
>>
>> When user leaves edit control for whatever reason it is automaticaly
>> closed.
>>
>> Is it worth for inclusion in wxWindows?
>>
>
> Perhaps as a MixIn. See wxPython.liib.mixins.grid.
>
I noted that after using it i got many leaks of wxGridCellEditorEvtHandler
Checking source found that grid conditionaly pushes such object and at
end unconditionaly pops one. Apparently it pops my handler. Should i put
these functions into C++ code to avoid leaks?
Perhaps you could push the handler in EVT_GRID_EDITOR_SHOWN and pop it in EVT_GRID_EDITOR_HIDDEN?
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!