Page 1 of 1

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

Posted: Wed Aug 15, 2018 3:34 am
by fishnet37222
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 709 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?

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

Posted: Wed Aug 15, 2018 6:10 am
by PB
Sorry for the stupid question but have you tried to swap the two lines (and/or set the style directly with Create())?

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

Posted: Wed Aug 15, 2018 11:32 am
by fishnet37222
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.

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

Posted: Wed Aug 15, 2018 3:17 pm
by ONEEYEMAN
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.