MDI: re-layout does not work properly on GTK/Linux

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
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 3714
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

MDI: re-layout does not work properly on GTK/Linux

Post by ONEEYEMAN » Thu Dec 12, 2019 3:58 pm

Hi, ALL,
I have a weird problem.

I am developing an application based on the MDI architecture.
The flow goes:

1. Application starts with the empty window and the toolbar.
2. When one of the toolbar tool is pressed the MDI child window is created with the view and user is presented with the couple of dialogs.
3. Based on the user responce from the dialog I either keep the current layout in the view or change it and call Layout().

To give more info - when the MDI child frame is created (and so is the view) I create all controls necessary, but hide the one I don't initially want and call Layout().
When needed, I hide the window I don't want and show the one I want and then call Layout() again.

What I'm seeing is following:

I have 2 laptops: one with Win 8.1/MSVC 2017 and one with Gentoo Linux/GNOME3/GTK3.22/gcc-5.5.

On Windows everything works as expected - Layout call puts the windows as it should according to the layout.
On Linux it does not work. Proper controls are hidden and shown but calling Layout() does not work. Resizing main application window makes the control to size correctly, but this is not the right way to do that.

What could be the cause of such behavior? One of the controls that initially hidden and then shown is the wxNotebook. Maybe this is the problem, since I am trying to show the wxNotebook inside wxNotebook?

Thank you.

P.S.: I didn't try to replicate the issue yet in a sample - wanted to ask first if anybody have any clue of what might be happening.

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

Re: MDI: re-layout does not work properly on GTK/Linux

Post by ONEEYEMAN » Sat Dec 14, 2019 5:04 am

A little update:
In my program I do the following:

1. Hide the control(s)
2. Show the control(s)
3. Call Layout()
4. Call sizer->Layout()
5. Present a modal dialog.
6. OK is pressed and program continues.

On Windows when the step 5 executes everything is sized correctly. On Linux that is not the case.

Just now I tried to call

Code: Select all

<MDIParentFrame *>->SendSizeEvent();
]

This fixes the problem, but not immediately.
The layout is applied only after step 6 (dialog is dismissed)

I tried to add a call to wxYield(), but it didn't help.

Any idea how to make GTK+ and MSW behave the same?

Thank you.

Post Reply