Ticket #14 (closed defect)

Opened 8 years ago

Last modified 6 years ago

nested splitters don't work with panels

Reported by: anonymous Owned by:
Priority: normal Milestone:
Component: Version:
Keywords: Cc: mbarbon
Blocked By: Patch: no
Blocking:

Description

Bug#: 62
Product: .wxWindows
Version: 2.1.13
Platform: wxGTK
OS/Version: Linux - RedHat
Status: NEW
Resolution:
Severity: normal
Priority: P2
Component: generic
AssignedTo: ???
ReportedBy: br_9801@…
URL:
Summary: nested splitters don't work with panels

I may be using wxSplitterWindow incorrectly, but this behavior strikes
me as rather non-orthogonal, probably a bug.

I'm trying to nest a splitter window inside another splitter window.
When making the child of the splitter a scrolled window, everything
works as expected; when making it a panel containing the scrolled
window, the second splitter doesn't show up.

Also, the splitter seems to ignore the SetMinimumPaneSize.

#include <iostream>
#include "wx/wx.h"
#include "wx/splitter.h"
#include "wx/dnd.h"
#include "wx/slider.h"

class TestCanvas: public wxScrolledWindow {
public:

TestCanvas( wxWindow *parent, wxWindowID id)

: wxScrolledWindow(parent,id) {}

void OnDraw(wxDC &dc) {

for(int i=0;i<1000;i+=10) {

dc.DrawLine(i,0,i,1000);
dc.DrawLine(0,i,1000,i);

}

}

};

class TestPanel : public wxPanel {
public:

TestCanvas *canvas;
wxBoxSizer *vbox;
TestPanel(wxWindow *parent,wxWindowID id)

:wxPanel(parent,id) {
vbox = new wxBoxSizer(wxVERTICAL);
canvas = new TestCanvas(this,-1);
canvas->EnableScrolling(true,true);
canvas->SetScrollbars(1,1,1000,1000,0,0);
vbox->Add(canvas,1,wxEXPAND|wxALL,3);
SetAutoLayout(TRUE);
SetSizer(vbox);
vbox->Fit(this);
vbox->SetSizeHints(this);
Show(true);

}

};

class MatchFrame : public wxFrame {
public:

wxSplitterWindow *splitter1,*splitter2;
wxWindow *canvas1,*canvas2,*canvas3;

MatchFrame(wxWindow *parent,wxWindowID id) :

wxFrame(parent,id,"MatchFrame") {

splitter1 = new wxSplitterWindow(this,-1);
splitter1->SetMinimumPaneSize(50);
splitter2 = new wxSplitterWindow(splitter1,-1);
splitter2->SetMinimumPaneSize(50);

#if 0

// this doesn't work--second splitter doesn't show up
canvas1 = new TestPanel(splitter1,-1);
canvas2 = new TestPanel(splitter2,-1);
canvas3 = new TestPanel(splitter2,-1);

#else

// this does work as expected, except for minimum size
canvas1 = new TestCanvas(splitter1,-1);
canvas2 = new TestCanvas(splitter2,-1);
canvas3 = new TestCanvas(splitter2,-1);

#endif

splitter2->SplitVertically(canvas2,canvas3,500);
splitter1->SplitVertically(canvas1,splitter2,200);

}

};

class MatchApp : public wxApp {

MatchFrame *frame;

bool OnInit() {

frame = new MatchFrame(0,-1);
frame->SetSize(wxSize(800,800));
frame->Show(true);
wxYield();
return true;

}

};

IMPLEMENT_APP(MatchApp)


Created an attachment (id=15)
A source file reproducing the problem.

Change History

Changed 6 years ago by mbarbon

The code works fine with MSW, GTK and Motif.
The bug was probably fixed since then.

Mattia

Note: See TracTickets for help on using tickets.