[wx-dev] ellipsize in wxStaticText (Re: wxStaticText GTK woes)
Vadim Zeitlin
vadim at wxwindows.org
Tue Jan 9 11:48:53 PST 2007
On Tue, 09 Jan 2007 19:23:02 +0100 Francesco Montorsi <f18m_cpp217828 at yahoo.it> wrote:
FM> I've added ellipsize support for the "generic" port and wxGTK.
Thanks!
FM> Currently however I'm not using a wxST_ELLIPSIZE style but rather the following
FM> ones:
FM>
FM> #define wxST_DOTS_START 0x0004
FM> #define wxST_DOTS_MIDDLE 0x0008
FM> #define wxST_DOTS_END 0x0010
Do we really need all 3, especially the first one? Is it ever useful?
FM> this is because I've found the (undocumented) wxST_DOTS_MIDDLE and wxST_DOTS_END
FM> were already there and used only by the Mac port.
FM> I'd say they should be renamed to wxST_ELLIPSIZE_START/MIDDLE/END...
In my experience non native English speakers tend to understand better
the meaning of "dots" than "ellipsis" so while I personally prefer
"ellipsis", maybe "dots" has the merit of being more clear to more people.
I could live with either...
FM> Also I've found that win32 supports natively ellipsization:
FM>
FM> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/commctls/staticcontrols/staticcontrolreference/staticcontrolstyles.asp
FM>
FM> MSDN says that the
FM>
FM> SS_ENDELLIPSIS
FM> SS_PATHELLIPSIS
FM> SS_WORDELLIPSIS
FM>
FM> styles are available for Windows NT or later.
Yes but I never know the difference between END and WORD ones, do you know
it?
FM> Unfortunately I've found that MSDN forgets to say that adding
FM> SS_WORDELLIPSIS or SS_ENDELLIPSIS "disables" the correct newline
FM> handling in static texts: the newlines in the labels are shown as
FM> square.
Pity. We'd have to switch to owner drawing for multiline labels with this
style then (I don't say this would need to be done immediately, it's just
the only solution that I see).
FM> So I currently add the SS_ENDELLIPSIS style only if the label does not
FM> contain newlines.
Provided that it's documented I think it's a quite acceptable solution.
Most of the time you don't want to use this style with multiline labels
anyhow.
The only additional question I have is how these styles are going to
affect the best size computation: the min size of a label using such styles
is not really defined, so what will GetBestSize() return? If it just
returns the same thing as now, the ellipsis will never appear...
Regards,
VZ
More information about the wx-dev
mailing list