I have a UI panel with a series of wxStaticBoxSizers on it to organize
some user parameters, and it's grown off the bottom of the panel. I
found wxCollapsiblePane, which sounds like exactly what I want to
replace the wxStaticBoxSizers with, so the user can expand the panes
they want to modify selectively. To test, I've replaced the first
staticbox with a collpane, but it doesn't behave appropriately. What
happens is it starts out collapsed and everything is nicely laid out.
When I first expand the collpane, everything else shifts down and
still looks nicely laid out. However, when I collapse the collpane
again, the widgets in the pane disappear, but the space remains - the
lower widgets don't move up to fill the empty space. Further clicks
on the collpane show and hide its widgets, but the layout is never
redone.
Any ideas what I'm doing wrong here? The available info on
collapsible panes seems pretty sparse...Thanks,
-stephen diverdi
-stephen...@gmail.com
s> However, when I collapse the collpane again, the widgets in the pane
s> disappear, but the space remains - the lower widgets don't move up to
s> fill the empty space.
Does the dialog in the collpane sample work for you? Which version and
port of wx do you use if it doesn't?
Regards,
VZ
--
TT-Solutions: wxWidgets consultancy and technical support
http://www.tt-solutions.com/
On Dec 17, 1:59 pm, Vadim Zeitlin <va...@wxwidgets.org> wrote:
>
> Does the dialog in the collpane sample work for you? Which version and
> port of wx do you use if it doesn't?
>
Hm, it does. This is windows, 2.8.9. I poked around a bit more and
found a ticket that mentions trouble with wxCollapsiblePane when
inside a wxNotebook, which is what I have, so I'll see if I can come
up with a simple example.
-stephen diverdi
-stephen...@gmail.com
Attached is a simple example that shows the funny behavior. The idea
is this is an app with some main display window on the left (the red
panel) and a notebook of pages of widgets on the right. If the
wxNotebook is replaced with a wxPanel, the behavior is as expected.
When it's a wxNotebook (as in the code below), the first time the
wxCollapsiblePane is expanded, the entire window resizes. Collapsing
the pane does not shift widgets below it back up. Also, if the window
is resized, collapsing or expanding the pane changes the size of the
whole window again. I suspect I'm just doing something wrong with the
setup of sizers and panels...Thanks,
-stephen diverdi
-stephen...@gmail.com
-------------------------------------------------------------------------------------------------------------------------------------
// based on collpane sample in wxWidgets 2.8.9. compiled with VS2005
SP1 on Win XP.
#include "wx/wxprec.h"
#ifndef WX_PRECOMP
#include "wx/log.h"
#include "wx/app.h"
#include "wx/frame.h"
#include "wx/panel.h"
#endif
#include "wx/collpane.h"
#include "wx/sizer.h"
#include "wx/stattext.h"
#include "wx/notebook.h"
//
----------------------------------------------------------------------------
// our classes
//
----------------------------------------------------------------------------
class MyApp: public wxApp
{
public:
MyApp() { }
virtual bool OnInit();
DECLARE_NO_COPY_CLASS(MyApp)
};
class MyFrame: public wxFrame
{
public:
MyFrame();
virtual ~MyFrame();
private:
wxWindow * makeControls ();
DECLARE_EVENT_TABLE()
DECLARE_NO_COPY_CLASS(MyFrame)
};
//
----------------------------------------------------------------------------
// MyApp
//
----------------------------------------------------------------------------
IMPLEMENT_APP(MyApp)
bool MyApp::OnInit()
{
// create and show the main frame
MyFrame* frame = new MyFrame;
frame->Show(true);
return true;
}
//
----------------------------------------------------------------------------
// MyFrame
//
----------------------------------------------------------------------------
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
END_EVENT_TABLE()
// My frame constructor
MyFrame::MyFrame()
: wxFrame(NULL, wxID_ANY, _T("wxCollapsiblePane sample"),
wxDefaultPosition, wxSize(420, 300),
wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE)
{
wxPanel *panel = new wxPanel( this, wxID_ANY, wxDefaultPosition,
wxSize( 512, 512 ) );
panel->SetBackgroundColour( *wxRED );
wxWindow *controls = makeControls();
wxBoxSizer *sizer = new wxBoxSizer( wxHORIZONTAL );
sizer->Add( panel, 1, wxEXPAND, 0 );
sizer->Add( controls, 0, wxEXPAND, 0 );
SetSizer( sizer );
}
wxWindow * MyFrame::makeControls ()
{
wxNotebook *notebook = new wxNotebook( this, wxID_ANY,
wxDefaultPosition, wxSize( 256, 512 ) );
wxWindow *panel = new wxPanel( notebook );
wxSizer *panelsizer = new wxBoxSizer( wxVERTICAL );
wxCollapsiblePane *cpane = new wxCollapsiblePane( panel, -1, wxT
("test!") );
wxWindow *win = cpane->GetPane();
new wxStaticText( win, -1, wxT( "Static control with absolute
coords" ), wxPoint( 10, 2 ) );
new wxStaticText( win, -1, wxT( "Yet another one!" ), wxPoint( 30,
30 ) );
panelsizer->Add( cpane, 0, wxGROW );
panelsizer->Add( new wxStaticText( panel, -1, wxT( "comes after
wxCollapsiblePane" ) ), 0, wxGROW );
panel->SetSizer( panelsizer );
notebook->AddPage( panel, wxT( "Page 1" ) );
return notebook;
}
MyFrame::~MyFrame()
{
}
s> Attached is a simple example that shows the funny behavior.
Could you please attach it to the Trac report which you found that already
reported this bug? Like this it won't get lost and somebody will have this
example at hand later.
Thanks,
On Dec 17 2008, 3:45 pm, sdiverdi <stephen.dive...@gmail.com> wrote:
> Attached is a simple example that shows the funny behavior. The idea
> is this is an app with some main display window on the left (the red
> panel) and a notebook of pages of widgets on the right. If the
> wxNotebook is replaced with a wxPanel, the behavior is as expected.
> When it's a wxNotebook (as in the code below), the first time the
> wxCollapsiblePane is expanded, the entire window resizes. Collapsing
> the pane does not shift widgets below it back up. Also, if the window
> is resized, collapsing or expanding the pane changes the size of the
> whole window again. I suspect I'm just doing something wrong with the
> setup of sizers and panels...Thanks,
>
Is there no reply to this problem? I'm ignoring it for now, but the
wxCollapsiblePane functionality still appears broken. Thanks and
happy new year,
-stephen diverdi
-stephen...@gmail.com
sdiverdi ha scritto:
If you can point me to the trac ticket you were mentioning and also attach there
the C++ example you've built, I'll try to debug this problem...
Francesco