How to duplicate the F2 behavior of a wxGrid?

When you press F2 on a cell on a wxGrid the contents of the cell are
selected. I have failed to find the way to achieve the same from a
command event handler. Calling grid_ctrl.ShowCellEditControl()
starts the editing but the text is not selected.

What is the way to make this work from a menu (command handler)?

Barry

Barry Scott wrote:

When you press F2 on a cell on a wxGrid the contents of the cell are
selected. I have failed to find the way to achieve the same from a
command event handler. Calling grid_ctrl.ShowCellEditControl()
starts the editing but the text is not selected.

What is the way to make this work from a menu (command handler)?

Calling textCtrl.SetSelection(-1, -1) will select the whole value.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

How do I get the textCtrl from the Grid cell?

Barry

···

At 28-11-2003 23:52, you wrote:

Barry Scott wrote:

When you press F2 on a cell on a wxGrid the contents of the cell are
selected. I have failed to find the way to achieve the same from a
command event handler. Calling grid_ctrl.ShowCellEditControl()
starts the editing but the text is not selected.
What is the way to make this work from a menu (command handler)?

Calling textCtrl.SetSelection(-1, -1) will select the whole value.

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwindows.org
For additional commands, e-mail: wxPython-users-help@lists.wxwindows.org

Barry Scott wrote:

How do I get the textCtrl from the Grid cell?

Catch the EVT_GRID_EDITOR_CREATED event and call event.GetControl().

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!