File: wx287.htm

package info (click to toggle)
wxwin2-doc 2.01-1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 6,540 kB
  • ctags: 5,968
  • sloc: cpp: 15,157; makefile: 434; sh: 6
file content (69 lines) | stat: -rw-r--r-- 2,332 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<HTML>
<head><title>wxSplitterWindow overview</title></head>

<BODY BGCOLOR=#FFFFFF>
<A NAME="wxsplitterwindowoverview"></A><CENTER>
<A HREF="wx.htm"><img align=center src="contents.gif" BORDER=0 ALT="Contents"></A> <A HREF="wx278.htm#overviews"><img align=center src="up.gif" BORDER=0 ALT="Up"></A> <A HREF="wx286.htm#wxfontoverview"><img align=center src="back.gif" BORDER=0 ALT="Previous"></A> <A HREF="wx288.htm#wxtreectrloverview"><img align=center src="forward.gif" BORDER=0 ALT="Next"></A> </CENTER><HR>

<H2>wxSplitterWindow overview</H2>
<P>
Classes: <A HREF="wx217.htm#wxsplitterwindow">wxSplitterWindow</A><P>
The following screenshot shows the appearance of a splitter window with a vertical split.<P>
<CENTER></CENTER><img src="splitter.gif"></A><CENTER></CENTER><P>
The style wxSP_3D has been used to show a 3D border and 3D sash.<P>
<A HREF="#topic1123">Example</A><BR>
<P>

<HR>
<A NAME="topic1123"></A>
<H3>Example</H3>
<P>
The following fragment shows how to create a splitter window, creating two
subwindows and hiding one of them.<P>
<FONT SIZE=2>
<PRE>
  splitter = new wxSplitterWindow(this, -1, wxPoint(0, 0), wxSize(400, 400), wxSP_3D);

  leftWindow = new MyWindow(splitter);
  leftWindow-&gt;SetScrollbars(20, 20, 50, 50);

  rightWindow = new MyWindow(splitter);
  rightWindow-&gt;SetScrollbars(20, 20, 50, 50);
  rightWindow-&gt;Show(FALSE);

  splitter-&gt;Initialize(leftWindow);

  // Set this to prevent unsplitting
//    splitter-&gt;SetMinimumPaneSize(20);
</PRE>
</FONT><P>
The next fragment shows how the splitter window can be manipulated after creation.<P>
<FONT SIZE=2>
<PRE>
  void MyFrame::OnSplitVertical(wxCommandEvent& event)
  {
        if ( splitter-&gt;IsSplit() )
            splitter-&gt;Unsplit();
        leftWindow-&gt;Show(TRUE);
        rightWindow-&gt;Show(TRUE);
        splitter-&gt;SplitVertically( leftWindow, rightWindow );
  }

  void MyFrame::OnSplitHorizontal(wxCommandEvent& event)
  {
        if ( splitter-&gt;IsSplit() )
            splitter-&gt;Unsplit();
        leftWindow-&gt;Show(TRUE);
        rightWindow-&gt;Show(TRUE);
        splitter-&gt;SplitHorizontally( leftWindow, rightWindow );
  }

  void MyFrame::OnUnsplit(wxCommandEvent& event)
  {
        if ( splitter-&gt;IsSplit() )
            splitter-&gt;Unsplit();
  }
</PRE>
</FONT><P>

</BODY></HTML>