Kirix Support Forums

[SOLVED] Sizing problems

Please post all general questions, comments, bug reports, and any other wxAUI feedback here.

[SOLVED] Sizing problems

Postby vdell on Mon Sep 25, 2006 2:13 am

Hi,

I have small sizing problem with wxAUI. I have my main frame which has its frame manager for the toolbar and for one wxPanel:

Code: Select all
ColligereMainFrame.hpp:

class ColligereMainFrame : public wxFrame
{
public:
   ColligereMainFrame ( wxWindow *pParent, wxWindowID id,
      const wxString &rTitle,
      const wxPoint &rPos = wxDefaultPosition,
      const wxSize &rSize = wxDefaultSize,
      long style = wxDEFAULT_FRAME_STYLE,
      const wxString &rName = "Colligere Main Frame");
   void CreateNewFile();
private:
        .
        .
        .
   ColligereAudioDatabaseLayout *mpActiveLayout;
   .
        .
        .
   wxPanel *mpLayoutParent;
   wxFrameManager mFrameMngr;
};

ColligereMainFrame.cpp

ColligereMainFrame::ColligereMainFrame ( wxWindow *pParent, wxWindowID id,
                              const wxString &rTitle,
                              const wxPoint &rPos,
                              const wxSize &rSize,
                              long style, const wxString &rName )
                              : wxFrame ( pParent, id, rTitle,
                              rPos, rSize, style, rName ),
                              mpActiveLayout(0), mpLayoutParent(0)
{
   mFrameMngr.SetManagedWindow ( this );

        .
   .
   .

   mpLayoutParent = new wxPanel ( this, -1, wxDefaultPosition,
      wxDefaultSize, wxNO_BORDER );

   mFrameMngr.AddPane ( mpLayoutParent, wxCENTER );

   .
   .
   .

   mFrameMngr.Update();
}

void ColligereMainFrame::CreateNewFile()
{
   .
   .
   .
   wxFileDialog dlg ( this, wxT ("Choose a file"),
      wxT(""), wxT(""), wxT( "COL Files (*.col)|*.col|All Files (*.*)|*.*" ),
      wxSAVE | wxOVERWRITE_PROMPT, wxDefaultPosition );

   if ( dlg.ShowModal() == wxID_OK )
   {
      .
      .
      .
      mpActiveLayout = new ColligereAudioDatabaseLayout
         ( mpLayoutParent, dlg.GetPath() );
      .
      .
      .
      mFrameMngr.Update();
      
}


So now there's the frame and the wxPanel which is used as a parent for other panels. Here's the ColligereAudioDatabaseLayout files:

Code: Select all
ColligereAudioDatabaseLayout.hpp:

class ColligereAudioDatabaseLayout : public wxPanel
{
public:
   ColligereAudioDatabaseLayout ( wxWindow *pParent, const wxString &rInputFile );
        .
        .
        .
private:
   wxFlatNotebook *mpItemInformation;
   ColligereListCtrl *mpDatabaseItems;
   ColligereDatabaseHandler *mpDbHandler;
   wxPanel *mpItemInfoPanel;
   wxFrameManager mLayoutMngr;
};

ColligereAudioDatabaseLayout.cpp:

ColligereAudioDatabaseLayout::ColligereAudioDatabaseLayout ( wxWindow *pParent,
                                      const wxString &rInputFile )
                                      : wxPanel ( pParent, wxID_ANY,
                                      wxDefaultPosition, pParent->GetClientSize(), wxTAB_TRAVERSAL,
                                      wxT("Colligere Database Layout Panel") )
{
   mLayoutMngr.SetManagedWindow ( this );
   mpDbHandler = new ColligereDatabaseHandler ( rInputFile );
   if ( mpDbHandler->IsDatabaseOpened() )
   {
      mpDatabaseItems = new ColligereListCtrl ( this, -1, wxDefaultPosition,
         wxSize ( 200, 100 ), wxLC_REPORT | wxLC_SINGLE_SEL | wxLC_HRULES | wxLC_VRULES );

      mpDatabaseItems->InsertColumn ( 0, _("Artist") );
      mpDatabaseItems->InsertColumn ( 1, _("Album") );

      mpItemInformation = new wxFlatNotebook ( this, -1,
         wxDefaultPosition, wxDefaultSize, wxFNB_NO_X_BUTTON |
         wxFNB_MOUSE_MIDDLE_CLOSES_TABS | wxFNB_NODRAG | wxFNB_VC71 );
      mpItemInfoPanel = new wxPanel ( mpItemInformation );

      mpItemInfoPanel->SetBackgroundColour
         ( wxSystemSettings::GetColour ( wxSYS_COLOUR_3DFACE ) );

      mpItemInformation->AddPage ( mpItemInfoPanel, _("Basic Information") );

      mLayoutMngr.AddPane ( mpDatabaseItems, wxLEFT, _("Database Items") );
      mLayoutMngr.AddPane ( mpItemInformation, wxCENTER );

      mLayoutMngr.Update();
   }
}


And now for the actual problem: When the ColligereAudioDatabaseLayout panel is created, everything is sized correctly. However, if I maximize the frame, the layout becomes this:

http://kahvipannu.fi/~mmortician/tmp/wxFrameManagerProb.png

So as you can see, the "inner layout" is not sized even though the frame is maximized. However, it's weird that if I maximize the frame before creating the ColligereAudioDatabaseLayout then everything works as they should (even if I minimize it again). This of course made me to do a hack where I maximize the frame in the code but that's something I naturally wouldn't want to do!

So, any ideas on how to fix this? Is it a problem that I have two wxFrameManagers in my app?

Thanks in advance!

Regards,
vdell

EDIT: Solved by removing the layout parent and tweaking some other stuff too.
vdell
Registered User
 
Posts: 1
Joined: Mon Sep 25, 2006 1:46 am

Return to wxAUI Questions, Thoughts & Feedback