Grid & CustomCtrl, Enter key goes out

Hello,

I attach a modified version of the demo sample GridCustEditor.py that add a control oustide the grid. I you Edit a cell with a custom ctrl the focus goes outside, but if edit another cell the focus stay on grid.

I would like that when press enter in the custom ctrl the focus do not go out the grid.

How can do it?

Thanks

GridCustEditor.py (8 KB)

···

--
Oswaldo Hern�ndez

Oswaldo Hernández wrote:

Hello,

I attach a modified version of the demo sample
GridCustEditor.py that add a control oustide the grid. I you
Edit a cell with a custom ctrl the focus goes outside, but if
edit another cell the focus stay on grid.

I would like that when press enter in the custom ctrl the
focus do not go out the grid.

In your Create method, change the following line -

    self._tc = wx.TextCtrl(parent, id, "")

to
    self._tc = wx.TextCtrl(parent, id, "",
        style=wx.TE_PROCESS_TAB|wx.TE_PROCESS_ENTER)

TE_PROCESS_ENTER fixes the problem that you reported.

TE_PROCESS_TAB fixes a different problem. Without it, if you edit the
control and press Tab, focus also passes to the control outside the grid,
instead of to the adjacent cell.

HTH

Frank Millman

···

--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en

Frank Millman escribió:

Oswaldo Hernández wrote:

Hello,

I attach a modified version of the demo sample GridCustEditor.py that add a control oustide the grid. I you Edit a cell with a custom ctrl the focus goes outside, but if edit another cell the focus stay on grid.

I would like that when press enter in the custom ctrl the focus do not go out the grid.

In your Create method, change the following line -

    self._tc = wx.TextCtrl(parent, id, "")

to
    self._tc = wx.TextCtrl(parent, id, "",
        style=wx.TE_PROCESS_TAB|wx.TE_PROCESS_ENTER)

TE_PROCESS_ENTER fixes the problem that you reported.

TE_PROCESS_TAB fixes a different problem. Without it, if you edit the
control and press Tab, focus also passes to the control outside the grid,
instead of to the adjacent cell.

Works fine :slight_smile: Thanks Frank.

But TE_PROCESS_TAB and TE_PROCESS_ENTER are styles for TextCtrl. For another widgets like wx.Choice, which style must i set? wx.WANTS_CHARS?

···

--
Oswaldo Hernández

--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en

Oswaldo Hernández wrote:

>
> TE_PROCESS_ENTER fixes the problem that you reported.
>
> TE_PROCESS_TAB fixes a different problem. Without it, if you edit the
> control and press Tab, focus also passes to the control outside the
> grid, instead of to the adjacent cell.
>

Works fine :slight_smile: Thanks Frank.

But TE_PROCESS_TAB and TE_PROCESS_ENTER are styles for
TextCtrl. For another widgets like wx.Choice, which style
must i set? wx.WANTS_CHARS?

I don't know off hand. Best is to try it, and if you have a problem, post
another message here, with a small working example, and hopefully either I
or someone else will be able to figure out a solution.

Frank

···

--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en