wxSplitterWindow hide right panel after double click Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
monax
In need of some credit
In need of some credit
Posts: 6
Joined: Fri Jul 10, 2009 6:26 pm
Contact:

wxSplitterWindow hide right panel after double click

Post by monax » Sun Aug 29, 2010 2:04 pm

Hi!
I write simple code with wxSplitterWindow. The right panel does not visible after double click by splitter. Why?

Code: Select all

#include <wx/wx.h>
#include <wx/splitter.h>

class MySplitApp : public wxApp {
	virtual bool OnInit();
};

class MySplitFrame : public wxFrame {
public:
	MySplitFrame(const wxString& title, const wxPoint& pos, const wxSize& size);
};

IMPLEMENT_APP(MySplitApp)

bool MySplitApp::OnInit() {
	MySplitFrame *frame = new MySplitFrame(wxT("MySpliteFrame"),
		wxDefaultPosition, wxDefaultSize);
	frame->Show(true);
	SetTopWindow(frame);

	return true;
}

MySplitFrame::MySplitFrame(const wxString& title, const wxPoint& pos,
	const wxSize& size) : wxFrame(NULL, wxID_ANY, title, pos, size) {

	wxBoxSizer *sizer = new wxBoxSizer(wxHORIZONTAL);

	wxSplitterWindow *splitter = new wxSplitterWindow(this, wxID_ANY,
		wxDefaultPosition, wxDefaultSize, wxSP_3D);

	wxPanel *left = new wxPanel(splitter, wxID_ANY, wxDefaultPosition,
		wxDefaultSize, wxTAB_TRAVERSAL);
	left->SetBackgroundColour(wxColour(0, 0, 0));

	wxPanel *right = new wxPanel(splitter, wxID_ANY, wxDefaultPosition,
		wxDefaultSize, wxTAB_TRAVERSAL);
	right->SetBackgroundColour(wxColour(255, 255, 255));

	splitter->SplitVertically(left, right, 200);

	sizer->Add(splitter, 1, wxEXPAND, 5);

	SetSizer(sizer);
	Layout();
}

DavidHart
Site Admin
Site Admin
Posts: 4008
Joined: Thu Jan 12, 2006 6:23 pm
Location: IoW, UK

Post by DavidHart » Sun Aug 29, 2010 3:13 pm

Hi,

If you mean it Unsplits after a double-click on the sash, that's a feature: see http://docs.wxwidgets.org/stablewxSplitterWindow::OnDoubleClickSash. You can see this happening in the 'splitter' sample too.
If you don't want this behaviour, either set a non-zero minimum pane size, or catch EVT_SPLITTER_DCLICK and call event.Veto() in the handler.

If it happens with a double-click on one the panes, then that's strange; and doesn't happen here in the wxGTK-2.8.11 'splitter' sample. Does it for you?

Regards,

David

monax
In need of some credit
In need of some credit
Posts: 6
Joined: Fri Jul 10, 2009 6:26 pm
Contact:

Post by monax » Mon Aug 30, 2010 3:26 pm

DavidHart wrote:Hi,

If you mean it Unsplits after a double-click on the sash, that's a feature: see http://docs.wxwidgets.org/stablewxSplitterWindow::OnDoubleClickSash. You can see this happening in the 'splitter' sample too.
If you don't want this behaviour, either set a non-zero minimum pane size, or catch EVT_SPLITTER_DCLICK and call event.Veto() in the handler.
Yes. I mean that. Thanks!

Post Reply