David C. Morrill | 28 Jan 19:51 2008

Problem with wx.Grid control on Windows

We've been wrestling with a problem using the wx.Grid control that only 
seems to have this behavior under Windows, and I'm hoping someone came 
help us out. We are using wxPython 2.8.7.1 and the problem is as follows:

We have a wx.Grid control that allows the user to edit in place cells 
containing text (for example). When the user is done editing the text, 
they quite often want to click on the containing dialog's OK button to 
dismiss the dialog and process the entered data. However, on Windows, 
they currently have to click the OK button twice. The first click on the 
OK button terminates the cell's text editing, but does not trigger the 
OK button. The second click on the OK button triggers the button and 
dismisses the dialog. Our user's don't like this behavior and have been 
complaining quite loudly to us to 'fix it'.

We've observed the same exact behavior in some of the wxPython 
wx.Grid-based examples as well (in particular, the "wx.Grid using a 
custom Table, with non-string data" demo (third button from the top) in 
the Core Windows/Controls//Grid demo), so it doesn't seem to be unique 
to our code. We've also noted that under Linux, a single click on the OK 
button will terminate the cell editing and dismiss the dialog. So it 
appears to be some kind of a platform issue.

I've been staring at our Python code and the underlying C++ Grid code 
trying to find the problem (or a solution), but so far have not had any 
luck. My best guess is that some part of the Grid code has done a mouse 
capture while the edit control is active, and is not forwarding the 
click event when it happens, but that's only a guess.

Does anyone have any suggestions on how we might solve or circumvent 
this problem? Thanks...
(Continue reading)

Robin Dunn | 29 Jan 02:34 2008

Re: Problem with wx.Grid control on Windows

David C. Morrill wrote:
> We've been wrestling with a problem using the wx.Grid control that only 
> seems to have this behavior under Windows, and I'm hoping someone came 
> help us out. We are using wxPython 2.8.7.1 and the problem is as follows:
> 
> We have a wx.Grid control that allows the user to edit in place cells 
> containing text (for example). When the user is done editing the text, 
> they quite often want to click on the containing dialog's OK button to 
> dismiss the dialog and process the entered data. However, on Windows, 
> they currently have to click the OK button twice. The first click on the 
> OK button terminates the cell's text editing, but does not trigger the 
> OK button. The second click on the OK button triggers the button and 
> dismisses the dialog. Our user's don't like this behavior and have been 
> complaining quite loudly to us to 'fix it'.
> 
> We've observed the same exact behavior in some of the wxPython 
> wx.Grid-based examples as well (in particular, the "wx.Grid using a 
> custom Table, with non-string data" demo (third button from the top) in 
> the Core Windows/Controls//Grid demo), so it doesn't seem to be unique 
> to our code. We've also noted that under Linux, a single click on the OK 
> button will terminate the cell editing and dismiss the dialog. So it 
> appears to be some kind of a platform issue.
> 
> I've been staring at our Python code and the underlying C++ Grid code 
> trying to find the problem (or a solution), but so far have not had any 
> luck. My best guess is that some part of the Grid code has done a mouse 
> capture while the edit control is active, and is not forwarding the 
> click event when it happens, but that's only a guess.

Not quite, but close.  The code that hides the cell edit control does an 
(Continue reading)


Gmane