wxStaticText wrapping (was: Something for GSoC2008?)
ATS
asteinarson at gmail.com
Tue Mar 4 14:41:57 PST 2008
> A> > I agree, dynamic wrapping would be widely welcomed. There was recently a
> A> > patch (I think applied, but possibly only to trunk?) that alters the
> A> > sizer system to do just this kind of wrapping, but operating at a sizer
> A> > level and not an individual control level. Might be applicable though.
> A>
> A> The problem wxWrapSizer solves is precisely this on
>
> I don't think wxWrapSizer can be used for static text wrapping (unless you
> put each word in its own sizer but this doesn't seem the right approach
>
In theory you could but it's very sub-optimal (each word would go into
a wxSizerItem, not a wxSizer). But the underlying algorithm is the same
one.
> A> The current implementation of wxWrapSizer solves the easiest case,
> A> when the horizontal extent is known early on and vertical extent is
> A> asked for later.
>
> I think this is enough for 95% of cases.
No. I actually implemented this simpler approach for wxStaticText. I
very soon found cases where text was put inside a vertically limited
section and when compiling some arbitrary dialogs it just didn't work
out very well. It is not a trivial problem.
This experience was what actually motivated me to change wxWrapSizer
to handle more cases.
> A> > Whether it's of sufficient scale for a GSoC project I'm not sure...
> A>
> A> A solution for text only can be a lot more efficient than 'using a
> A> wxSizerItem per word'. I'd say it's a big enough problem. Specially
> A> when tying into layout rendering and the whole sizer machinery. It
> A> should work smoothly when a dialog is resized for example.
>
wxStaticText would be a window put inside a layout without any help
of wxWrapSizer. It can also use the same forwarding mechanism
when the first size component is determined. And it would have to
answer correctly to min size calculations as the available first
size component is updated.
There are a lot of similarities, but wxWrapSizer is a sizer and
wxStaticText a window.
Regards
// ATS.
More information about the wx-dev
mailing list