Hi!
From: Yusdi Santoso [mailto:yusdi@hotmail.com]
Sent: Saturday, August 18, 2007 4:15 PM
To: wxPython-users@lists.wxwidgets.org
Subject: Cancel grid cell editor
Hi all,
Is there a way to cancel a grid cell editor once a cell has
been double clicked. Here is the use case:
I want to replace the inline cell editor with a popup dialog
because of the complex way to select the input.
What I do now is to capture the EVT_GRID_EDITOR_SHOWN event
and on the event handler popup my dialog box and handle the
user input. However I was not able to cancel
(disable/inactivate) the normal cell editor when I decide to
use the popup dialog. I tried calling EndEdit on the cell
editor but it caused the program to crash. I think this is
because EDITOR_SHOWN event is called before BeginEdit?
Anybody know any better way for achieving this? This for me
looked like a very indirect way for doing what I need.
Thanks,
Yusdi
_________________________________________________________________
Messenger Café open for fun 24/7. Hot games, cool
activities served daily.
Visit now. http://cafemessenger.com?ocid=TXT_TAGHM_AugHMtagline
If you look at the demo code for the SimpleGrid, you'll see the following:
def OnEditorShown(self, evt):
## if evt.GetRow() == 6 and evt.GetCol() == 3 and \
## wx.MessageBox("Are you sure you wish to edit this cell?",
## "Checking", wx.YES_NO) == wx.NO:
## evt.Veto()
## return
evt.Skip()
I think you need to use the commented out portion and edit it accordingly
and put the evt.Skip() in an "else" statement. I do something like this
for my ListCtrl and it works there. I'm sure the same concept applies in
this case.
Mike
···
-----Original Message-----
Thanks a lot Mike, this works just like I wanted.
Yusdi
···
From: "Mike Driscoll" <mdriscoll@co.marshall.ia.us>
To: "'Yusdi Santoso'" <yusdi@hotmail.com>
CC: <wxPython-users@lists.wxwidgets.org>
Subject: RE: Cancel grid cell editor
Date: Mon, 20 Aug 2007 09:07:02 -0500 (CDT)
Hi!
> -----Original Message-----
> From: Yusdi Santoso [mailto:yusdi@hotmail.com]
> Sent: Saturday, August 18, 2007 4:15 PM
> To: wxPython-users@lists.wxwidgets.org
> Subject: Cancel grid cell editor
>
> Hi all,
>
> Is there a way to cancel a grid cell editor once a cell has
> been double clicked. Here is the use case:
> I want to replace the inline cell editor with a popup dialog
> because of the complex way to select the input.
>
> What I do now is to capture the EVT_GRID_EDITOR_SHOWN event
> and on the event handler popup my dialog box and handle the
> user input. However I was not able to cancel
> (disable/inactivate) the normal cell editor when I decide to
> use the popup dialog. I tried calling EndEdit on the cell
> editor but it caused the program to crash. I think this is
> because EDITOR_SHOWN event is called before BeginEdit?
>
> Anybody know any better way for achieving this? This for me
> looked like a very indirect way for doing what I need.
>
> Thanks,
>
> Yusdi
>
> _________________________________________________________________
> Messenger Caf� � open for fun 24/7. Hot games, cool
> activities served daily.
> Visit now. http://cafemessenger.com?ocid=TXT_TAGHM_AugHMtagline
>
If you look at the demo code for the SimpleGrid, you'll see the following:
def OnEditorShown(self, evt):
## if evt.GetRow() == 6 and evt.GetCol() == 3 and \
## wx.MessageBox("Are you sure you wish to edit this cell?",
## "Checking", wx.YES_NO) == wx.NO:
## evt.Veto()
## return
evt.Skip()
I think you need to use the commented out portion and edit it accordingly
and put the evt.Skip() in an "else" statement. I do something like this
for my ListCtrl and it works there. I'm sure the same concept applies in
this case.
Mike
_________________________________________________________________
Tease your brain--play Clink! Win cool prizes! http://club.live.com/clink.aspx?icid=clink_hotmailtextlink2