Kirix Support Forums

wxAUI and XRC derived panel

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

wxAUI and XRC derived panel

Postby mosfet on Sat Jan 14, 2006 10:22 am

Hi,

I am not sure my question is really related to wxAUI but I will try first here.
I have a two different content window declared like this whose one is derived from a XRC description:

Code: Select all

//-----------------------------------------------------------------------------
// Event table: connect the events to the handler functions to process them
//-----------------------------------------------------------------------------

BEGIN_EVENT_TABLE(ReaderPropPanel, wxPanel)
END_EVENT_TABLE()

ReaderPropPanel::ReaderPropPanel(wxWindow* parent):
wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize)
{
   wxXmlResource::Get()->LoadPanel(parent, _T("MyPanel1"));

   wxBitmap bmp;
}

// class destructor
ReaderPropPanel::~ReaderPropPanel()
{
   // insert your code here
}

void MainFrame::CreateIDE()
{
    CreateMenubar();

    CreateToolbars();

    m_pReaderPanel = new ReaderPropPanel(this);
    m_pReaderPanel->Show(false);
    m_FrmMgr.AddPane(m_pReaderPanel,wxPaneInfo().Name(wxT("reader_panel")).
    CenterPane().Hide());
    m_FrmMgr.Update();

    pMsgDockBar  = new MsgDockBar (this,wxT("Messages"), wxPoint(64,64 ), wxSize(120,120), &m_FrmMgr );
    pProjDockBar = new ProjDockBar(this,wxT("Project"),  wxPoint(64,64 ), wxSize(255,80), &m_FrmMgr );

    // Add content window
    wxTextCtrl *content = new wxTextCtrl(this, wxID_ANY, wxT("This is the content window"),
        wxPoint(), wxSize(100,100), wxTE_MULTILINE | wxTE_WORDWRAP);
    m_FrmMgr.AddPane(content, wxPaneInfo().Name(wxT("content")).CenterPane());
    m_FrmMgr.Update();

    //content->LoadFile(wxT("demo_text.txt"));

    // make some default perspectives
    wxString perspective_all = m_FrmMgr.SavePerspective();

    // Show Content window
    m_FrmMgr.GetPane(wxT("content")).Show();

    // "commit" all changes made to wxFrameManager
    m_FrmMgr.Update();

}


The problem is when I do :
m_pReaderPanel = new ReaderPropPanel(this);
m_pReaderPanel->Show(false);
m_FrmMgr.AddPane(m_pReaderPanel,wxPaneInfo().Name(wxT("reader_panel")).
CenterPane().Hide());
m_FrmMgr.Update();

My panel is shown while I don't want to. What's wrong with that ?
mosfet
Registered User
 
Posts: 4
Joined: Tue Jan 10, 2006 2:23 pm
Location: Paris

Postby Ben on Sat Jan 14, 2006 11:45 am

Hey there. It's a bit tough to say why this is happening whithout more context code. If you step into the wxFrameManager::Update() function, you'll see the frame showing being done there (you shouldn't have to step in too deep).

You are right in that, from your code, it appears that your center window should be hidden.

Thanks for any info.
User avatar
Ben
Kirix Support Team
 
Posts: 525
Joined: Mon Dec 19, 2005 6:29 am

Postby mosfet on Sat Jan 14, 2006 1:48 pm

IF I do this it works

Code: Select all
m_pReaderPanel = (ReaderPropPanel*) wxXmlResource::Get()->LoadPanel(this, _T("MyPanel1"));

    wxBitmap bmp;
   wxString file = ConfigManager::Get()->Read(_T("data_path")) + _T("/images/splash.png");
   bmp.LoadFile(file, wxBITMAP_TYPE_PNG);
   XRCCTRL(*m_pReaderPanel, "bmpVisual", wxStaticBitmap)->SetBitmap(bmp);


but I want to do this :
Code: Select all
m_pReaderPanel = new ReaderPropPanel(this);


with ReaderPropPanel defined like that :

Code: Select all
ReaderPropPanel::ReaderPropPanel(wxWindow* parent):
wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize)
{
   wxXmlResource::Get()->LoadPanel(parent, _T("MyPanel1"));

   wxBitmap bmp;
}



bwilliams wrote:Hey there. It's a bit tough to say why this is happening whithout more context code. If you step into the wxFrameManager::Update() function, you'll see the frame showing being done there (you shouldn't have to step in too deep).

You are right in that, from your code, it appears that your center window should be hidden.

Thanks for any info.
mosfet
Registered User
 
Posts: 4
Joined: Tue Jan 10, 2006 2:23 pm
Location: Paris

Return to wxAUI Questions, Thoughts & Feedback