macOS: Wrap the text into multiple lines using wxstaticText label not working

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
Post Reply
[email protected]
I live to help wx-kind
I live to help wx-kind
Posts: 173
Joined: Fri Jan 08, 2021 8:19 am

macOS: Wrap the text into multiple lines using wxstaticText label not working

Post by [email protected] »

We are using SetMinSize() to set the max width in pixels for the text to wrap into next line and also the height in pixels which can accommodate long text. When I use the following code to calculate the height of the message text of one line, it always returns the same value on macOS for different display scaling.

Code: Select all

wxSize error_message_size = lbl_error_message->GetTextExtent(title) 
error_message_size.GetHeight()


The wrapped second line is not visible on macOS. Is there a better way to set the text wrapping dynamically in wxDialog() code.
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 6420
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: macOS: Wrap the text into multiple lines using wxstaticText label not working

Post by ONEEYEMAN »

Hi,
Did you call Layout() afterwards?

Thank you.
[email protected]
I live to help wx-kind
I live to help wx-kind
Posts: 173
Joined: Fri Jan 08, 2021 8:19 am

Re: macOS: Wrap the text into multiple lines using wxstaticText label not working

Post by [email protected] »

No. I will try this and let you know.

Any reason why the issue is only on macOS and not on other platforms without calling Layout()?

Regards
Sridhar
[email protected]
I live to help wx-kind
I live to help wx-kind
Posts: 173
Joined: Fri Jan 08, 2021 8:19 am

Re: macOS: Wrap the text into multiple lines using wxstaticText label not working

Post by [email protected] »

I tried with layout() still the same issue.
Looks like the below code is not calculating the right height in pixels on macOS. Hence, it is not able to accommodate the lines/warp the lines in the given height as width wrap is set correctly.

Code: Select all

wxSize error_message_size = lbl_error_message->GetTextExtent(title) 
error_message_size.GetHeight()

Is there anything we have to do extra for macOS to get this work similar to Linux and Windows?
Post Reply