Developer forums (C::B DEVELOPMENT STRICTLY!) > Development

wxSmith use bad constructor for wxStaticBoxSizer

<< < (2/2)

Miguel Gimenez:
Fixed in r13767.

LR83:
Great, work fine  :)
But I suggest using a temporary variable because wxStaticBoxSizer can have many children.
So, code could be:
In wxStaticBoxSizer.cpp:

--- Code: ---        case wxsCPP:
        {
            AddHeader(_T("<wx/sizer.h>"),GetInfo().ClassName,hfInPCH);
            AddHeader(_T("<wx/statbox.h>"),GetInfo().ClassName,hfInPCH);
            Codef(_T("%C(%s, %W, %t);\n"),
                    (Orient == wxHORIZONTAL) ? _T("wxHORIZONTAL") : _T("wxVERTICAL"),
                    Label.wx_str());
            Codef(_T("wxStaticBox *SB_%s = %s->GetStaticBox();\n"),GetVarName().wx_str(),GetVarName().wx_str());
            return;
        }
--- End code ---

in wxSizer.cpp:

--- Code: ---        if (GetInfo().ClassName == "wxStaticBoxSizer")
        {
            // Use the static box as parent, as required by wxWidgets since 2.9.1
            wxsCoderContext* context = GetCoderContext();
            const wxString saveParent(context->m_WindowParent);
            context->m_WindowParent = "SB_" + GetVarName();
            Child->BuildCode(context);
            context->m_WindowParent = saveParent;
        }
        else
        {
            // Using same parent as we got, sizer is not a parent window
            Child->BuildCode(GetCoderContext());
        }
--- End code ---

Bug Killer:

--- Quote from: Miguel Gimenez on January 12, 2026, 03:59:40 pm ---Fixed in r13767.

--- End quote ---

Works fine on AlmaLinux 9 with wxWidgets 3.3.1. Don't forget to modify slightly all the dialogs, frames and panels. I just add a space somewhere and remove it.

guacamole:
When I experimented with this, my friends loved discovering our unique creations together! Any tips on level design?

Miguel Gimenez:
Nonsense from profile spammer reported to moderator.

Navigation

[0] Message Index

[*] Previous page

Go to full version