The wrapsizer sample used the panel best size before wxWrapSizer had been laid out at the initial width. On MSW this could leave wrapped rows clipped and hide lower controls.
Size once from the initial best width, lay out the panel so wrapping updates its required height, then keep that width and apply the new height before showing the frame.
Fixes #10852
https://github.com/wxWidgets/wxWidgets/pull/27036
(1 file)
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.![]()
@vadz commented on this pull request.
In samples/wrapsizer/wrapsizer.cpp:
> @@ -167,7 +167,13 @@ WrapSizerFrame::WrapSizerFrame()
// Set sizer for the panel
m_panel->SetSizer(sizerRoot);
- SetClientSize(m_panel->GetBestSize());
+ // Let wxWrapSizer calculate its height for the initial width.
Is this really the only way to make this work correctly? It looks like something is missing in the API if we need all this to get the right layout...
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.![]()
@LegalizeAdulthood commented on this pull request.
In samples/wrapsizer/wrapsizer.cpp:
> @@ -167,7 +167,13 @@ WrapSizerFrame::WrapSizerFrame()
// Set sizer for the panel
m_panel->SetSizer(sizerRoot);
- SetClientSize(m_panel->GetBestSize());
+ // Let wxWrapSizer calculate its height for the initial width.
You're right, this is probably addressing the symptom rather than the underlying awkwardness.
The problem is that wxWrapSizer's required height depends on the width it is given, so the initial unconstrained GetBestSize() can't really answer the question the sample is asking. This patch forces the answer by doing an initial size/layout pass and then asking again, but that does make the sample depend on layout side effects.
There does seem to already be an API for this: wxWindow::GetMinSizeFromKnownDirection() forwards to the window's sizer, and wxWrapSizer::CalcMinSizeFromKnownDirection() implements the width-known calculation. So I think the better direction is to use that path directly for the sample's initial width, instead of doing the extra SetClientSize()/Layout() cycle. I'll rework it that way.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.![]()
@LegalizeAdulthood pushed 1 commit.
—
View it on GitHub or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.![]()