Open the Design tab quickly on Windows the first time

A page built on first click is now built before it is shown, as the idle
prebuild already does, so its controls are not created inside a visible
window. This takes the Design tab's first open on Windows from ~9 s to ~1 s.
This commit is contained in:
SoftFever
2026-10-03 12:38:47 +08:00
parent 9351bbaa83
commit 38df8022e3
2 changed files with 10 additions and 1 deletions
+5
View File
@@ -57,6 +57,11 @@ public:
// virtual from the book's ShowWithEffect() only for wxSHOW_EFFECT_NONE, the default.
bool Show(bool show = true) override
{
// Built before this page is shown, as an idle prebuild builds it. On MSW every control
// created or moved inside a shown window re-clips and repaints its shown siblings, so
// building a large panel into a shown page took seconds.
if (show && wxGetTopLevelParent(this)->IsShown())
this->ensure();
const bool changed = wxPanel::Show(show);
if (show) {
// The book shows its first page as it is inserted, before startup has chosen the