I am trying to get Hide/Show to work for panes. So far no luck. I looked at the Roadmap and it appears this function is not yet implemented? But then I see posts that indicate it might be:
viewtopic.php?f=15&t=167&p=467
Is this feature available under wxWidgets 2.8.4?
Thanks,
Marco
Kirix Support Forums
Does Show/Hide of Panes work under wxWidgets 2.8.4?
6 posts
• Page 1 of 1
- mdefreitas
- Registered User
- Posts: 12
- Joined: Tue Jul 10, 2007 3:14 pm
Re: Does Show/Hide of Panes work under wxWidgets 2.8.4?
Hi,
Are you just trying to hide and show a pane? Try this:
All the best,
Ben
Are you just trying to hide and show a pane? Try this:
- Code: Select all
wxAuiPaneInfo& info = m_mgr.GetPane(wnd);
info.Hide();
m_mgr.Update();
All the best,
Ben
Ben Williams
Kirix Support Team
Kirix Support Team
-
Ben - Kirix Support Team
- Posts: 525
- Joined: Mon Dec 19, 2005 6:29 am
Re: Does Show/Hide of Panes work under wxWidgets 2.8.4?
Ben wrote:Hi,
Are you just trying to hide and show a pane?
Yes... I am trying to "Show" a pane that I closed with the "x" button on the pane's frame. I am using the code you suggest. Here is a complete small example that fails to work. I set up a center pane and then create a pane I want to hide/show on the left. I "x" the pane on the left, and then I use the pulldown menu to bring it back (the callback does the "Show"). This fails under both wxMSW and wxGTK.
- Code: Select all
#include "wx/wx.h"
#include "wx/aui/aui.h"
//============================================
// Declare the application class
//============================================
class MyApp : public wxApp
{
public:
virtual bool OnInit();
};
//============================================
// Declare the main frame class
//============================================
class MyFrame : public wxFrame
{
public:
enum {
ID_ShowPane = wxID_HIGHEST + 1,
};
MyFrame(const wxString& title);
~MyFrame();
private:
void onExit(wxCommandEvent& event);
void onShowPane(wxCommandEvent& event);
wxAuiManager m_mgr;
// This class handles events
DECLARE_EVENT_TABLE()
};
DECLARE_APP(MyApp)
IMPLEMENT_APP(MyApp)
//============================================
// MyApp::OnInit: Initialize the application
//============================================
bool MyApp::OnInit()
{
MyFrame *frame = new MyFrame(wxT("My App"));
SetTopWindow(frame);
frame->Show(true);
return true;
}
//============================================
//============================================
//===
//=== Implementation of MyFrame
//===
//============================================
//============================================
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
EVT_MENU(wxID_EXIT, MyFrame::onExit)
EVT_MENU(MyFrame::ID_ShowPane, MyFrame::onShowPane)
END_EVENT_TABLE()
//============================================
// MyFrame::MyFrame: Constructor.
//============================================
MyFrame::MyFrame(const wxString& title) :
wxFrame(NULL, wxID_ANY, title)
{
//~~~ Tell wxFrameManager to manage this frame
m_mgr.SetManagedWindow(this);
//~~~ Build the menubar
wxMenuBar *menuBar = new wxMenuBar();
wxMenu *fileMenu = new wxMenu;
fileMenu->Append(wxID_EXIT, wxT("Exit"));
wxMenu *viewMenu = new wxMenu;
viewMenu->Append(ID_ShowPane, wxT("Show Pane"));
menuBar->Append(fileMenu, wxT("&File"));
menuBar->Append(viewMenu, wxT("&View"));
SetMenuBar(menuBar);
//~~~ Create a docked pane
wxTextCtrl *p = new wxTextCtrl(this, -1, wxT("pane"));
m_mgr.AddPane(p, wxAuiPaneInfo().Name(wxT("pane")).
Caption(wxT("Pane")).DestroyOnClose(false).Left());
//~~~ Create a center pane
wxTextCtrl *c = new wxTextCtrl(this, -1, wxT("Center"));
m_mgr.AddPane(c, wxAuiPaneInfo().Name(wxT("center")).CenterPane());
//~~~ Commit changes to wxAuiManager
m_mgr.Update();
}
//============================================
// MyFrame::~MyFrame: Destructor.
//============================================
MyFrame::~MyFrame()
{
m_mgr.UnInit();
}
//============================================
// MyFrame::onExit: Exit event handler
//============================================
void MyFrame::onExit(wxCommandEvent& event)
{
Close();
}
//============================================
// MyFrame::onShowPane: Show the Navigator panel.
//============================================
void MyFrame::onShowPane(wxCommandEvent& event)
{
wxAuiPaneInfo pi = m_mgr.GetPane(wxT("pane"));
if (pi.IsOk()) {
if (!pi.IsShown()) {
pi.Show();
m_mgr.Update();
}
}
}
- mdefreitas
- Registered User
- Posts: 12
- Joined: Tue Jul 10, 2007 3:14 pm
Re: Does Show/Hide of Panes work under wxWidgets 2.8.4?
Should that be
i.e. a reference to the pane rather than a copy?
Regards,
Julian
- Code: Select all
wxAuiPaneInfo& pi = m_mgr.GetPane(wxT("pane"));
i.e. a reference to the pane rather than a copy?
Regards,
Julian
- Julian Smart
- Registered User
- Posts: 17
- Joined: Sun Nov 05, 2006 4:45 pm
Re: Does Show/Hide of Panes work under wxWidgets 2.8.4?
Julian Smart wrote:Should that be
- Code: Select all
wxAuiPaneInfo& pi = m_mgr.GetPane(wxT("pane"));
i.e. a reference to the pane rather than a copy?
Regards,
Julian
Indeed it should be... Thanks Julian!
- mdefreitas
- Registered User
- Posts: 12
- Joined: Tue Jul 10, 2007 3:14 pm
Re: Does Show/Hide of Panes work under wxWidgets 2.8.4?
Julian Smart wrote:Should that beVegas Shows Recovery Finance
- Code: Select all
wxAuiPaneInfo& pi = m_mgr.GetPane(wxT("pane"));
i.e. a reference to the pane rather than a copy?
Regards,
Julian
Thanks for the response Julian. I was having the same issue so I am glad you caught that!
-Jim
- jimm1909
- Registered User
- Posts: 1
- Joined: Wed Oct 20, 2010 1:52 pm
6 posts
· Page 1 of 1
Return to wxAUI Questions, Thoughts & Feedback