wxPanel not visible

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
wxwxwx
I live to help wx-kind
I live to help wx-kind
Posts: 180
Joined: Thu Dec 20, 2012 4:25 pm

wxPanel not visible

Post by wxwxwx »

Hello,
i have a simple AUI manged frame, just with one panel. I can't get the panel visible.
Possibly it is related to (Windows specific) settings store in background and runtime persitent.

The following simple code shows no panel caption when i run it in Visual Studio 2017.
(When i start the panel floated and dock it, the caption is visible.)

Only frame code is provided. Just create the frame in wxApp::OnInit.
Header:

Code: Select all

class mainframe2 : public wxFrame
{
private:

protected:
    wxPanel* panel_top;

public:

    mainframe2 (wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize (500, 300), long style = wxDEFAULT_FRAME_STYLE | wxTAB_TRAVERSAL);
    wxAuiManager m_mgr;

    ~mainframe2 ();

};
Source:

Code: Select all

mainframe2::mainframe2 (wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style) : wxFrame (parent, id, title, pos, size, style)
{
    this->SetSizeHints (wxDefaultSize, wxDefaultSize);
    m_mgr.SetManagedWindow (this);
    m_mgr.SetFlags (wxAUI_MGR_DEFAULT);

    panel_top = new wxPanel (this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
    panel_top->SetBackgroundColour (wxColour (255, 0, 0));

    m_mgr.AddPane (panel_top, wxAuiPaneInfo ().Left ().Caption (wxT ("Top Panel")).PinButton (true).Dock ().Resizable ().FloatingSize (wxDefaultSize).DockFixed (true).Floatable (false).BestSize (wxSize (100, 100)));


    m_mgr.Update ();
    this->Centre (wxBOTH);
}

mainframe2::~mainframe2 ()
{
    m_mgr.UnInit ();

}
wxwxwx
I live to help wx-kind
I live to help wx-kind
Posts: 180
Joined: Thu Dec 20, 2012 4:25 pm

Re: wxPanel not visible

Post by wxwxwx »

Update: I could not get it work with just one panel, except float and dock.
However, when having a 2nd panel and removed the center flag for the top panel, all panels show their caption.
Post Reply