Page 1 of 1

wxGridBagSizer in wxCrafter

Posted: Wed May 11, 2016 4:20 pm
by iwbnwif
Hi,

I am trying to use a wxGridBagSizer in wxCrafter (version 2.5, Ubuntu and Windows 10) to layout something like the following:
wxGBS.png
If I add a wxGridBagSizer to any window in wxCrafter it seems to overwrite the entire contents of the window. Also the "Show Preview" function does not seem to work.

However, the code that is generated by wxCrafter is correct, and indeed compiles to produce the desired output as above:

Code: Select all

    m_pMainSizer = new wxBoxSizer(wxVERTICAL);
    this->SetSizer(m_pMainSizer);
    
    m_pMainPanel = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxSize(-1,-1), wxTAB_TRAVERSAL);
    
    m_pMainSizer->Add(m_pMainPanel, 1, wxEXPAND, 5);
    
    m_pGridBagSizer = new wxGridBagSizer(0, 0);
    m_pMainPanel->SetSizer(m_pGridBagSizer);
    
    m_pStatic = new wxStaticText(m_pMainPanel, wxID_ANY, _("Static Text Label:"), wxDefaultPosition, wxSize(-1,-1), 0);
    
    m_pGridBagSizer->Add(m_pStatic, wxGBPosition(0,0), wxGBSpan(1,1), wxALL|wxEXPAND|wxALIGN_CENTER_VERTICAL, 5);
    
    m_pButton = new wxButton(m_pMainPanel, wxID_ANY, _("My Button"), wxDefaultPosition, wxSize(-1,-1), 0);
    
    m_pGridBagSizer->Add(m_pButton, wxGBPosition(0,1), wxGBSpan(1,1), wxALL, 5);
    
    m_pText = new wxTextCtrl(m_pMainPanel, wxID_ANY, wxT(""), wxDefaultPosition, wxSize(-1,-1), wxTE_RICH2);
    #if wxVERSION_NUMBER >= 3000
    m_pText->SetHint(wxT(""));
    #endif
    
    m_pGridBagSizer->Add(m_pText, wxGBPosition(1,0), wxGBSpan(2,2), wxALL|wxEXPAND, 5);
    m_pGridBagSizer->AddGrowableCol(0);
Obviously this is undesirable though because I would like to be able to visually design the layout ;)

Re: wxGridBagSizer in wxCrafter

Posted: Wed May 11, 2016 6:14 pm
by Lotharyx
I had written a post about an assert, but it turned out to be unrelated.

So yeah, it's some sort of issue with wxCrafter itself, and I have the same problem. I'm using nested Sizers to achieve the look I want.

CodeLite 9.1.6 on Debian Jessie
gcc-4.9

Re: wxGridBagSizer in wxCrafter

Posted: Wed May 11, 2016 6:41 pm
by eranif
Can you provide a minimal example with wxGridBagSizer that reproduces this?

Eran

Re: wxGridBagSizer in wxCrafter

Posted: Wed May 11, 2016 7:17 pm
by iwbnwif
Can you provide a minimal example with wxGridBagSizer that reproduces this?
Please try to open the attached in wxCrafter. The layout should be as the image shown in my initial post.

Re: wxGridBagSizer in wxCrafter

Posted: Wed May 11, 2016 7:23 pm
by eranif
Thanks!