When reparenting a wxFrame on macOS, child controls appear in the wrong window

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
ButtonPolisher
Earned a small fee
Earned a small fee
Posts: 11
Joined: Wed Jun 30, 2021 3:22 am

When reparenting a wxFrame on macOS, child controls appear in the wrong window

Post by ButtonPolisher »

Hello,

Consider this code:

Code: Select all

    MyFrame *frame = new MyFrame("Minimal wxWidgets App");
    frame->Show(true);

    auto childFrame = new wxFrame(nullptr, wxID_ANY, "Child Frame");
    auto simpleButton = new wxButton(childFrame, wxID_ANY, "Simple Button");
    childFrame->Reparent(frame);
    childFrame->Show();
When compiled and run, on Windows and Linux it produces an empty parent frame, and a child frame with a button as a child.
However, on macOS, the button is put into a parent frame after the reparent. See the screenshot:
Image

Using Reparent() is important for me, since in my application it is required to create the frames without parents first and then set up parent-child relationships.

I am using wxWidgets-3.1.6.
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 5861
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: When reparenting a wxFrame on macOS, child controls appear in the wrong window

Post by ONEEYEMAN »

Hi,
Which OSX version you are testing on?

Thank you.
ButtonPolisher
Earned a small fee
Earned a small fee
Posts: 11
Joined: Wed Jun 30, 2021 3:22 am

Re: When reparenting a wxFrame on macOS, child controls appear in the wrong window

Post by ButtonPolisher »

> Which OSX version you are testing on?

11.6.1
Post Reply