Little problem with wxStaticText Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
Maeglix
Experienced Solver
Experienced Solver
Posts: 74
Joined: Thu Nov 17, 2016 8:07 am

Little problem with wxStaticText

Post by Maeglix »

Hi all,

I have a problem with wxStaticText. To be more precise, my problem comes when the text has a bigger width than the control.
When the text contains all "normal characters" like the "bbbbbb" line on the screenshot, the text is cut. That's what i want.
But when the text contains a "/" i lost all the right part of the text as you can see on the 2nd line of the screenshot (the full line is visible in the wxTextControl on the top).

Image

Thanks for your help !
jgrzybowski
Earned some good credits
Earned some good credits
Posts: 113
Joined: Sat Sep 24, 2011 9:32 pm
Location: Poland

Re: Little problem with wxStaticText

Post by jgrzybowski »

Try to use:
SetLabelText ( const wxString & text )
instead of SetLabel();
Maybe it helps? Regards
coderrc
Earned some good credits
Earned some good credits
Posts: 141
Joined: Tue Nov 01, 2016 2:46 pm

Re: Little problem with wxStaticText

Post by coderrc »

looks like a text wrapping issue
I would try setting wxStaticText::Wrap to -1 and possibly consider using the wxST_ELLIPSIZE_END style
Maeglix
Experienced Solver
Experienced Solver
Posts: 74
Joined: Thu Nov 17, 2016 8:07 am

Re: Little problem with wxStaticText

Post by Maeglix »

Using wxST_ELLIPSIZE_END (even without setting wraper to -1) style solved the problem ! I'm a bit mad i saw this style in the doc and tried it but I did it on the wrong StaticText ><

Anyway i tried the SetLabelText too and it didn't work. And setting the wraper to -1 without the style didn't work neither.

The problem is solved but I don't get why it was doing this, any idea ? I'm curious.
coderrc
Earned some good credits
Earned some good credits
Posts: 141
Joined: Tue Nov 01, 2016 2:46 pm

Re: Little problem with wxStaticText

Post by coderrc »

Maeglix wrote:The problem is solved but I don't get why it was doing this, any idea ? I'm curious.
the text "bbbbbbbbbbbbbbbbbb" has no word boundaries to wrap on, so it does not wrap
the text "posting.php" contains the word boundary "/", so it wraps the posting.php to the next line which is of course not shown.
Maeglix
Experienced Solver
Experienced Solver
Posts: 74
Joined: Thu Nov 17, 2016 8:07 am

Re: Little problem with wxStaticText

Post by Maeglix »

Ok thank you for the explanation.
Post Reply