[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lmi] Ctrl-Ins in wxGrid cell

From: Vadim Zeitlin
Subject: Re: [lmi] Ctrl-Ins in wxGrid cell
Date: Thu, 16 Jul 2020 01:38:35 +0200

On Wed, 15 Jul 2020 22:09:46 +0000 Greg Chicares <gchicares@sbcglobal.net> 

GC> Let me say first of all that I really like the wxGrid census
GC> manager so far, and consider it a big improvement.

 Thank you! It would have been a huge disappointment if all the time spent
on it didn't result in at least some improvement, so it's great to hear
that it did.

GC> Now...what should happen if I place some data on the X clipboard,
GC> then Ctrl-Ins in a wxGrid cell, running lmi for msw under wine?

 I'm a bit confused here and would like to ask: would you mean "Shift-Ins"
by "Ctrl-Ins" here and below? Because Ctrl-Ins is the standard shortcut for
"Copy" operation (together with Ctrl-C), but your message would make much
more sense to me if I do "%s/Copy-/Shift-/g" on it because Shift-Ins (or
Ctrl-V) is the standard shortcut for "Paste" operation, which you seem to
have in mind.

GC> Observed behavior: Nothing happens.

 This is not quite true, even though nothing _seems_ to happen, the text
representation of the current selection (meaning the current cell, if there
is no selection) is copied to the clipboard. A side question is whether
wxGrid (or lmi) should indicate that the copy has taken place in some way.
I couldn't think of any non-annoying way to do it, but maybe you have some

GC> If I press F2 so that I'm "editing" the cell, then pasting works as
GC> though I had typed the clipboard contents manually into the cell.
GC> Expected behavior: I thought Ctrl-Ins would enter "edit mode".

 Here I have trouble even after my mental s/Ctrl/Shift/ substitution. Would
you really just expect it to enter editing mode? I'd expect Shift-Ins or
Ctrl-V to replace the current cell contents with the clipboard contents.
Or, maybe, enter editing mode _and_ replace the current cell contents with
the clipboard contents, letting the user to accept or cancel it later.

GC> If I have "xyzzy" on the clipboard, and I want to paste it into
GC> a text field like "Agent Name", it would seem natural to expect
GC> that Ctrl-Ins alone would paste the data.

 Yes (after s///). However what should happen if you have "foo\nbar" on the
clipboard? In lmi case it seems clear that it would be natural to replace
the contents of the current cell with "foo" and of the cell just below it
with "bar". But this is probably not true in general, i.e. in some cases
you might want to paste the entire multiline string in the current cell.
And even when it is true, there are some annoying edge cases (literally):
what should happen when the current cell is in the last row?

GC> That's how a spreadsheet program would work. However, this grid
GC> control is not a spreadsheet, because each cell is strongly
GC> typed, and entering the wrong data type is forbidden, so we need
GC> to consider each datatype.

 And there is also this consideration, indeed.

GC> Thus, if I use F2-Ctrl-Ins to paste "xyzzy" into...
GC>  - an enumerative (drop-down combobox) column like "Agent State",
GC> nothing happens (because "xyzzy" is not in the list)
GC>  - a date column like "Effective Date": likewise
GC>  - a numeric column like "Inforce Glp": the classic lmi message
GC> (which looks like a 1990s compiler warning) appears,

 FYI I have plans for improving this, but I didn't want to delay the grid
patch until I could put them in place, so I'll do it in a future patch (and
after a future wxWidgets update as it will almost certainly require some
more changes at its level).

GC> (1) Whether we might remap Ctrl-Ins to F2-Ctrl-Ins.

 We could do this, of course. But this wouldn't allow to ever paste
multiline (and/or TAB-separated) strings. Of course, lmi has separate
copy/paste census commands for this, but could it be useful to use simple
copy/paste for doing it with parts of the grid instead?

GC> (BTW, FWIW, around version 8 or so, vim made just such a change: in
GC> normal mode, Ctrl-Ins in effect maps to i-Ctrl-Ins now.)

(I actually never use Shift-Ins in Vim (although I do use it, and not
Ctrl-V, elsewhere), but looking at "nmap <S-Ins>" it is indeed mapped to
"*P (quote being part of the mapping), so it really works in the normal

GC> (2) For the longer term, whether the old lmi code (unaltered
GC> by the wxGrid patch) should be changed, e.g. so that pasting
GC> "xyzzy" into an integer spinctrl doesn't reset it to zero,

 This would indeed be bad and could be avoided by explicitly checking that
current clipboard data is compatible with the cell type. But a better
solution would be to improve error checking (and error messages) in the
constrained text entries. As I said above, I'm definitely aware of this
problem (it would be hard not to be, to be honest...) and do want to fix it
in the relatively near future (i.e. before the end of the year).

 Thanks for testing this and please let me know if you'd like to make
Shift-Ins work like F2 followed by Shift-Ins (without any effect on the
checkboxes) or if you have any other ideas after reading this message.

 Thanks in advance,

Attachment: pgpc3aMl2aWwt.pgp
Description: PGP signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]