Author Topic: The sizers arent doing anything?  (Read 2264 times)

Offline MadBoat

  • Multiple posting newcomer
  • *
  • Posts: 11
The sizers arent doing anything?
« 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: [Select]
#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: [Select]
...
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: [Select]
#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


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. :)

Online oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12009
    • Travis build status
Re: The sizers arent doing anything?
« Reply #1 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.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline MadBoat

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: The sizers arent doing anything?
« Reply #2 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