How to prevent erasing the background of a custom control on macOS

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.
fishnet37222
Knows some wx things
Knows some wx things
Posts: 38
Joined: Sat May 06, 2017 1:40 pm

How to prevent erasing the background of a custom control on macOS

Postby fishnet37222 » Wed Aug 15, 2018 3:34 am

I'm using wxWidgets 3.1.1 on macOS 10.14 with clang as the compiler.

I've created a custom control by subclassing wxWindow. I'm having a hard time getting rid of the white that's showing at the corners of the control.

2018-08-14_23-23-08.png
2018-08-14_23-23-08.png (1.9 KiB) Viewed 222 times

Here are the first two lines of code in the constructor:

Code: Select all

wxWindow::SetBackgroundStyle(wxBG_STYLE_PAINT);
wxWindow::Create(parent, id, pos, size, style, name);


Is there any way to force macOS to not erase the background?

PB
Part Of The Furniture
Part Of The Furniture
Posts: 1790
Joined: Sun Jan 03, 2010 5:45 pm

Re: How to prevent erasing the background of a custom control on macOS

Postby PB » Wed Aug 15, 2018 6:10 am

Sorry for the stupid question but have you tried to swap the two lines (and/or set the style directly with Create())?

fishnet37222
Knows some wx things
Knows some wx things
Posts: 38
Joined: Sat May 06, 2017 1:40 pm

Re: How to prevent erasing the background of a custom control on macOS

Postby fishnet37222 » Wed Aug 15, 2018 11:32 am

I do not see any overload of wxWindow::Create() that allows you to set the background style. When I swap the two lines, the background becomes black. I basically want the background to be transparent. However, when I call wxWindow::IsTransparentBackgroundSupported(), it returns false and the reason is "The system does not support background transparency." According to the documentation, macOS does support background transparency.

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 2834
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: How to prevent erasing the background of a custom control on macOS

Postby ONEEYEMAN » Wed Aug 15, 2018 3:17 pm

Hi,
You probably should open a ticket on trac.wxwidgets.org about the transparency.
Modify the minimal sample by adding the appropriate call and see whether it still fails the detection. If it does - open a new ticket and attach the patch to the sample with you changes.

Thank you.


Return to “Platform Related Issues”

Who is online

Users browsing this forum: No registered users and 3 guests