wxGrid autoend cell edit control - again

Hi,

the following conversation happened half an year ago. The question is - did you manage to finalize this, Niki? If so, may I see how, please?

Thank you,

Cristina.

···

-----------
Date: Sat, 02 Nov 2002 09:28:25 -0800
From: Robin Dunn <robin@alldunn.com>
To: wxPython-users@lists.wxwindows.org
Subject: Re: [wxPython-users] Re: [wxPython] wxGrid autoend cell edit control

Niki Spahiev wrote:

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

-------------------------------------------------------
Xnet scaneaza automat toate mesajele impotriva virusilor folosind RAV AntiVirus.
Xnet automatically scans all messages for viruses using RAV AntiVirus.

Nota: RAV AntiVirus poate sa nu detecteze toti virusii noi sau toate variantele lor.
Va rugam sa luati in considerare ca exista un risc de fiecare data cand deschideti
fisiere atasate si ca MobiFon nu este responsabila pentru nici un prejudiciu cauzat
de virusi.

Disclaimer: RAV AntiVirus may not be able to detect all new viruses and variants.
Please be aware that there is a risk involved whenever opening e-mail attachments
to your computer and that MobiFon is not responsible for any damages caused by
viruses.

C. Iacob wrote:

Hi,

the following conversation happened half an year ago. The question is - did you manage to finalize this, Niki? If so, may I see how, please?

Thank you,

Cristina.

I am still using same code plus

     def Reflect( self, event ):
         #print self.__class__, 'Reflect', event.GetEventType()
         if event.GetEventType() == wxEVT_KILL_FOCUS:
             #print 'SaveEditControlValue'
             self.SaveEditControlValue()

transfer value when grid looses focus.

Niki Spahiev