Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Plugins development => Topic started by: MadBoat on August 15, 2015, 01:52:46 am

Title: The sizers arent doing anything?
Post by: MadBoat on August 15, 2015, 01:52:46 am
Yesterday I was fiddling with some unrelated problems (AFAIK), and suddenly the sizers (both box sizers and grid sizers) I use in the new window I'm working on stop doing anything. I kept paring away functionality from my window until it's idiot-simple, and I still can't get the sizers to DO anything. The problem does seem to be limited to this new window, but I have no idea why.

I give up. Can you see anything I've done wrong?

BotsSummaryWindow4.h
Code
#include <editorbase.h>
#include <wx/sizer.h>
#include <wx/button.h>

class BotsSummaryWindow4 : public EditorBase
{
    public:
    BotsSummaryWindow4(wxWindow * parent, wxString title);

};

MAD_Debugging_support.cpp
Code
...
void MAD_Debugging_Support::OnHitSummaryWindow(wxCommandEvent& event)
{
    DoStartSummary();
}

void MAD_Debugging_Support::DoStartSummary()
{
    if (!m_summaryDisplayed)
    {
        m_summaryDisplay = new BotsSummaryWindow4((wxWindow *) Manager::Get()->GetEditorManager()->GetNotebook(), wxT("BotsDisplay"));
        m_summaryDisplayed = true;
    }
    m_summaryDisplay->SetFocus();
}
...

BotsSummaryWindow4.cpp
Code
#include "BotsSummaryWindow4.h"
BotsSummaryWindow4::BotsSummaryWindow4(wxWindow * parent, wxString title) : EditorBase(parent, title)
{
    wxBoxSizer *        buttonsSizer = new wxBoxSizer(wxHORIZONTAL);
    wxPanel *           helpMeObiwan = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxSize(500, 500));
    wxButton *          west = new wxButton(helpMeObiwan, wxID_ANY, _T("west"), wxPoint(100, 100));
    wxButton *          east = new wxButton(helpMeObiwan, wxID_ANY, _T("east"), wxPoint(110, 110));

    buttonsSizer->Add(west, TRUE, wxEXPAND | wxALL, 1);
    buttonsSizer->Add(east, TRUE, wxEXPAND | wxALL, 1);
    helpMeObiwan->SetSizer(buttonsSizer);
}
how it looks
(http://i60.tinypic.com/28hk7eg.png)

This is identical to how it appears if I don't use sizers at all.

-----

I notice also that I've been quite liberal asking for help around here recently. It is appreciated. :)
Title: Re: The sizers arent doing anything?
Post by: oBFusCATed on August 15, 2015, 09:23:29 am
You're not using wxsmith, so your question is better asked in the wx forums/mailing list.
Title: Re: The sizers arent doing anything?
Post by: MadBoat on August 18, 2015, 01:57:08 am
Yep. Got some useful advice over there. Here's the thread, which has a code sample.

https://forums.wxwidgets.org/viewtopic.php?f=1&t=41364

Needed to call Fit() manually... don't know why I got away with that before, but it works now... good enough.

Jason