News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

The sizers arent doing anything?

Started by MadBoat, August 15, 2015, 01:52:46 AM

Previous topic - Next topic

MadBoat

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

#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

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

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

oBFusCATed

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!]

MadBoat

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