Re: [wxpython-users] Edited wx.grid and keyboard

80 views
Skip to first unread message

Rich Shepard

unread,
Jun 3, 2008, 1:12:54 PM6/3/08
to wxpytho...@lists.wxwidgets.org
On Tue, 3 Jun 2008, Tim Roberts wrote:

> The usual key for "edit this cell" is F2. That's what all of the Windows
> spreadsheet apps use, including Excel. Then Enter commits the changes and
> exits the editor, and Esc discards the changes and exits the editor.

How about Ctrl-E (for 'edit')? The tab key is equivalent to the Enter key
and could be defined as moving to an adjacent cell in a specified direction.

In XessSE, the linux/UNIX spreadsheet I've used for many years, all I need
do is place the cursor in a cell and start typing. Doesn't matter if I move
there by the arrow keys, tab key, or trackball. Works this way in the
wxPython text entry widgets, too.

> "Print" is too unintuitive to be practical, in my opinion.

Yup.

Rich

--
Richard B. Shepard, Ph.D. | Integrity Credibility
Applied Ecosystem Services, Inc. | Innovation
<http://www.appl-ecosys.com> Voice: 503-667-4517 Fax: 503-667-8863

raffaello

unread,
Jun 3, 2008, 1:37:15 PM6/3/08
to wxpytho...@lists.wxwidgets.org
Glad to get some reply.
The only advantage of Control + Print was that it was unlikely anybody had already used such an awkward combination: if F2 has a meaning alike  in Excel, people should not change their habits.
Rather selfishly, on the contrary, I would not switch to Ctrl-E because I already use it for allowing the edition of a single row in the grid (for saving afterwards the changes with another act). I am really old, and the idea scares me of being able of maiming haphazardly my data, and then forget completely this crime: better take some precautions.

2008/6/3 Rich Shepard <rshe...@appl-ecosys.com>:
_______________________________________________
wxpython-users mailing list
wxpytho...@lists.wxwidgets.org
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users

Rich Shepard

unread,
Jun 3, 2008, 1:49:54 PM6/3/08
to wxpytho...@lists.wxwidgets.org
On Tue, 3 Jun 2008, raffaello wrote:

> The only advantage of Control + Print was that it was unlikely anybody had
> already used such an awkward combination: if F2 has a meaning alike in
> Excel, people should not change their habits. Rather selfishly, on the
> contrary, I would not switch to Ctrl-E because I already use it for
> allowing the edition of a single row in the grid (for saving afterwards
> the changes with another act). I am really old, and the idea scares me of
> being able of maiming haphazardly my data, and then forget completely this
> crime: better take some precautions.

Heh-heh-heh! Try switching between emacs (C, python, SQL, xhtml, and
LaTeX) and joe (for config and other sysadmin files which uses the old
WordStar key strokes) and something like OO.o's Writer. Ctrl-e moves the
cursor to the end of the line in the former two and changes justfication to
centered in the last one. PITA!

But, our old codger venting is moving off topic. :-)

Robin Dunn

unread,
Jun 5, 2008, 3:41:14 PM6/5/08
to wxpytho...@lists.wxwidgets.org
Tim Roberts wrote:
> raffaello wrote:
>> Having been born many decades ago, I still belong to the ancient tribe
>> of the ones who like the keyboard and not so much mice.
>
> Me, too.
>
>
>> So I wrote a little code to open the cell editor without moving my
>> hands off the keys, and from there to pass to another cell the same
>> way. You will find this code here below if you wish to copy it.
>>
>> BTW, I chose the keys combination of Control + Print (keycode 321) to
>> open the cell editor, and of Alt + Control + {314: arrow left, 316:
>> arrow right, 315: arrow up, 317: arrow down} for leaving it. But if
>> anybody can suggest some more rational or comfortable combination, I
>> shall gladly comply.

>
> The usual key for "edit this cell" is F2. That's what all of the
> Windows spreadsheet apps use, including Excel. Then Enter commits the
> changes and exits the editor, and Esc discards the changes and exits the
> editor.

The wx.grid should already be supporting the above keys (F2, Esc and
Enter) and also it allows Tab to complete and exit the cell editor but
moves to the next cell to the right instead of the next cell down
(although if you have the grid on a panel with other widgets then the
Tab can get stolen for navigation) and also most cell editor types will
allow you to move to the cell and start typing to engage the cell
editor. So yes Raffaello, you've reinvented boiled eggs. ;-)


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

raffaello

unread,
Jun 4, 2008, 12:15:54 AM6/4/08
to wxpytho...@lists.wxwidgets.org
Done deal, F2 shall be.

So, the last version of the handler is:

    def OnEVT_KEY_UP(self, event):
        if event.GetKeyCode() == 341 : #F2
               self.ShowCellEditControl()
        # if you want, as I do, to limit this possibility to a specific row,
        # just name it in a condition:
        # iif self.GetGridCursorRow() == self.EditedRow:
        #      self.ShowCellEditControl()

Surely it is possible to enter data directly into a grid, and when you cope with large amounts of many-faceted data it is a good thing to have the whole (and the sequence) under your eyes. A very good beginning for me was chapter 14 of WIA, God bless Robin, and starting from there you had better build your own editors and renderers. When and if you are interested, remember that I have some work already done and reduced to modules.

2008/6/4 Rich Shepard <rshe...@appl-ecosys.com>:
On Tue, 3 Jun 2008, raffaello wrote:

do you want to push me back to Ctrl-Print, or is there a monastery in Nepal
where they use that combination as a mantra? :-)

Raffaello,

 There may well be a ^P mantra somewhere, but that does not make it most
suitable for your grid editor tools. Since we can enter data directly into a
text edit widget or a list control, can we also do so in a grid widget?
Since I'm hung up with my application seg faulting, I've not progressed to
really learning and understanding the family of editors for grid cells.

 My second choice would be a function key such as F2.


Rich

--
Richard B. Shepard, Ph.D.               |  Integrity            Credibility
Applied Ecosystem Services, Inc.        |            Innovation
<http://www.appl-ecosys.com>     Voice: 503-667-4517      Fax: 503-667-8863
Reply all
Reply to author
Forward
0 new messages