On Wed, 30 Sep 2015 00:55:34 -0700 (PDT) Tobias T wrote:
TT> > The question is, what could be done to improve the situation? An obvious
TT> > answer is to avoid using multiline values with wxDataViewCtrl, but perhaps
TT> > we could do something better?
TT>
TT> As a user I wouldn't even expect a control like dataviewctrl to render
TT> multiline values.
TT> But maybe that's just me :)
To be honest, I hadn't thought about this neither until yesterday. But it
turns out that in the case of the program I'm working on, there is really
nothing fundamentally wrong with showing multiline strings in wxDVC and
even though I'm not sure if it's really useful, currently it's just plain
ugly and unusable: ugly because the very top pixel of the second line is
shown (in the generic version), resulting in something that looks very much
like display corruption and unusable because editing a multiline string in
a single line text control is pretty weird, at least under MSW (GTK is not
ideal but usable).
To give a simpler and self-contained example: suppose wxDVC is used as a
front-end to a database table: even if typically a database column contains
only single line strings, you can't really guarantee (well, you can with
some database-level constraints but IME nobody does this) that NLs don't
get into it. And if they do, it would be better to show them in at least
somewhat reasonable way instead of doing what we do now.
TT> > For the rendering part, the choice is either
TT> > render only the first line of the value, possibly with some "continuation"
TT> > character(s), or show the full multiline value on a single line after
TT> > replacing the new line characters with something else, e.g. "RETURN SYMBOL
TT> > (U+23CE)" (
http://www.fileformat.info/info/unicode/char/23ce/index.htm).
TT>
TT> If support for multi line is added I would definitely prefer all lines to
TT> be rendered in multiple lines.
I don't think this is realistic, this would require using the
wxDV_VARIABLE_LINE_HEIGHT style and you don't want to use it as it
completely kills the performance with many items.
TT> Or if we stick with a single line I would prefer "..." (or similar) to
TT> rendering a single line with return symbols.
I thought about this but I think the ellipsis is not very clear because we
already use it for, well, ellipsization, so you wouldn't see at a glance if
the value is truncated horizontally or vertically. We could use some other
character instead, e.g. VERTICAL ELLIPSIS (U+22EE), but it's not very clear
neither.
And, of course, whichever symbol we would use, it still wouldn't be
possible to see the full multiline text in the cell which is the main
benefit of flattening it into a single line.
TT> > For the editing part, the best solution would clearly be to use a
TT> > multiline text control, but I am not sure how to do this in the GTK (let
TT> > alone OS X) version, does anybody know if it would be possible?
TT>
TT> I don't know if this is possible, but if it is not possible on at least one
TT> native implementation, it shouldn't be added to the generic one.
I agree. But I am probably not ready to work on this anyhow, for my needs
using a single line wxTextCtrl with the s/\n/\x23ce/g replacement is good
enough.
TT> > As a stop gap, we could at least edit the value with the new lines
TT> > replaced by the "RETURN SYMBOL" in single line wxTextCtrl. In fact, I
TT> > wonder if we shouldn't always do this (i.e. s/\n/\x23ce/g) in single
TT> > line wxTextCtrl under MSW because while it's definitely not great,
TT> > it's much more clear and useful than the standard behaviour.
TT>
TT> Allowing multi line editing in a single line wxTextCtrl seems hackish to me
It definitely is, but it kind of makes sense though, doesn't it? At least
IMO it makes more sense than the native behaviour which is plainly unusable
(just try pasting a multiline string into a simple EDIT and play with it).
In fact, the native behaviour was pretty similar to this in the older
Windows versions where NLs appeared as vertical bars in the text controls.
And this is similar to the native GTK behaviour too.
TT> and the expected behavior probably depends on context. Like in a more
TT> technical program (e.g. IDE, Other Dev tool) it might make more sense
TT> to replace new lines with \n as that what users are used to.
I think any program that really wants to support editing multiline text
would use a wxTextCtrl with wxTE_MULTILINE for it anyhow. The question is
whether the proposed change would help if a text with NLs gets used in a
control which was not meant for editing multiline text. And IMO it would.
TT> Also how would the user even enter the unicode return character in case
TT> he want's to add a new line?
He would need to copy and paste it, just as with GTK "00 0a" box. Again,
this is clearly not ideal but I think it's still better than the current
situation: right now to add a new line you would have to copy and paste an
_invisible_ NL character.
Regards,
VZ