Search documentation of wx

# View Source wxSplitterWindow (wx v2.4.3)

This class manages up to two subwindows.

The current view can be split into two programmatically (perhaps from a menu command), and unsplit either programmatically or via the `wxSplitterWindow` user interface.

## Styles

This class supports the following styles:

- wxSP_3D: Draws a 3D effect border and sash.

- wxSP_THIN_SASH: Draws a thin sash.

- wxSP_3DSASH: Draws a 3D effect sash (part of default style).

- wxSP_3DBORDER: Synonym for wxSP_BORDER.

- wxSP_BORDER: Draws a standard border.

- wxSP_NOBORDER: No border (default).

- wxSP_NO_XP_THEME: Under Windows, switches off the attempt to draw the splitter using Windows theming, so the borders and sash will take on the pre-XP look.

- wxSP_PERMIT_UNSPLIT: Always allow to unsplit, even with the minimum pane size other than zero.

- wxSP_LIVE_UPDATE: Don't draw XOR line but resize the child windows immediately.

See:

- `wxSplitterEvent`

- Overview splitterwindow

This class is derived, and can use functions, from:

- `wxWindow`

- `wxEvtHandler`

wxWidgets docs: wxSplitterWindow

## Events

Event types emitted from this class:

- `command_splitter_sash_pos_changing`

- `command_splitter_sash_pos_changed`

- `command_splitter_unsplit`

# Summary

## Types

wxSplitterWindow()

## Functions

create(This, Parent)

Equivalent to `create(This, Parent, [])`.

create/3

Creation function, for two-step construction.

destroy(This)

Destroys the object

getMinimumPaneSize(This)

Returns the current minimum pane size (defaults to zero).

getSashGravity(This)

Returns the current sash gravity.

getSashPosition(This)

Returns the current sash position.

getSplitMode(This)

Gets the split mode.

getWindow1(This)

Returns the left/top or only pane.

getWindow2(This)

Returns the right/bottom pane.

initialize(This, Window)

Initializes the splitter window to have one pane.

isSplit(This)

Returns true if the window is split, false otherwise.

new()

Default constructor.

new(Parent)

Equivalent to `new(Parent, [])`.

new/2

Constructor for creating the window.

replaceWindow(This, WinOld, WinNew)

This function replaces one of the windows managed by the `wxSplitterWindow` with another one.

setMinimumPaneSize(This, PaneSize)

Sets the minimum pane size.

setSashGravity(This, Gravity)

Sets the sash gravity.

setSashPosition(This, Position)

Equivalent to `setSashPosition(This, Position, [])`.

setSashPosition/3

Sets the sash position.

setSplitMode(This, Mode)

Sets the split mode.

splitHorizontally(This, Window1, Window2)

Equivalent to `splitHorizontally(This, Window1, Window2, [])`.

splitHorizontally/4

Initializes the top and bottom panes of the splitter window.

splitVertically(This, Window1, Window2)

Equivalent to `splitVertically(This, Window1, Window2, [])`.

splitVertically/4

Initializes the left and right panes of the splitter window.

unsplit(This)

Equivalent to `unsplit(This, [])`.

unsplit/2

Unsplits the window.

updateSize(This)

Causes any pending sizing of the sash and child panes to take place immediately.

# Types

Link to this type

# wxSplitterWindow()

View Source

    -type wxSplitterWindow() :: wx:wx_object().

# Functions

Link to this function

# create(This, Parent)

View Source

    -spec create(This, Parent) -> boolean() when This :: wxSplitterWindow(), Parent :: wxWindow:wxWindow().

Equivalent to `create(This, Parent, [])`.

Link to this function

# create/3

View Source

    -spec create(This, Parent, [Option]) -> boolean()
                    when
                        This :: wxSplitterWindow(),
                        Parent :: wxWindow:wxWindow(),
                        Option ::
                            {id, integer()} |
                            {pos, {X :: integer(), Y :: integer()}} |
                            {size, {W :: integer(), H :: integer()}} |
                            {style, integer()}.

Creation function, for two-step construction.

See `new/2` for details.

Link to this function

# destroy(This)

View Source

    -spec destroy(This :: wxSplitterWindow()) -> ok.

Destroys the object

Link to this function

# getMinimumPaneSize(This)

View Source

    -spec getMinimumPaneSize(This) -> integer() when This :: wxSplitterWindow().

Returns the current minimum pane size (defaults to zero).

See: `setMinimumPaneSize/2`

Link to this function

# getSashGravity(This)

View Source

    -spec getSashGravity(This) -> number() when This :: wxSplitterWindow().

Returns the current sash gravity.

See: `setSashGravity/2`

Link to this function

# getSashPosition(This)

View Source

    -spec getSashPosition(This) -> integer() when This :: wxSplitterWindow().

Returns the current sash position.

See: `setSashPosition/3`

Link to this function

# getSplitMode(This)

View Source

    -spec getSplitMode(This) -> wx:wx_enum() when This :: wxSplitterWindow().

Gets the split mode.

See:

- `setSplitMode/2`

- `splitVertically/4`

- `splitHorizontally/4`

Link to this function

# getWindow1(This)

View Source

    -spec getWindow1(This) -> wxWindow:wxWindow() when This :: wxSplitterWindow().

Returns the left/top or only pane.

Link to this function

# getWindow2(This)

View Source

    -spec getWindow2(This) -> wxWindow:wxWindow() when This :: wxSplitterWindow().

Returns the right/bottom pane.

Link to this function

# initialize(This, Window)

View Source

    -spec initialize(This, Window) -> ok when This :: wxSplitterWindow(), Window :: wxWindow:wxWindow().

Initializes the splitter window to have one pane.

The child window is shown if it is currently hidden.

Remark: This should be called if you wish to initially view only a single pane in the splitter window.

See:

- `splitVertically/4`

- `splitHorizontally/4`

Link to this function

# isSplit(This)

View Source

    -spec isSplit(This) -> boolean() when This :: wxSplitterWindow().

Returns true if the window is split, false otherwise.

Link to this function

# new()

View Source

    -spec new() -> wxSplitterWindow().

Default constructor.

Link to this function

# new(Parent)

View Source

    -spec new(Parent) -> wxSplitterWindow() when Parent :: wxWindow:wxWindow().

Equivalent to `new(Parent, [])`.

Link to this function

# new/2

View Source

    -spec new(Parent, [Option]) -> wxSplitterWindow()
                 when
                     Parent :: wxWindow:wxWindow(),
                     Option ::
                         {id, integer()} |
                         {pos, {X :: integer(), Y :: integer()}} |
                         {size, {W :: integer(), H :: integer()}} |
                         {style, integer()}.

Constructor for creating the window.

Remark: After using this constructor, you must create either one or two subwindows with the splitter window as parent, and then call one of `initialize/2`, `splitVertically/4` and `splitHorizontally/4` in order to set the pane(s). You can create two windows, with one hidden when not being shown; or you can create and delete the second pane on demand.

See:

- `initialize/2`

- `splitVertically/4`

- `splitHorizontally/4`

- `create/3`

Link to this function

# replaceWindow(This, WinOld, WinNew)

View Source

    -spec replaceWindow(This, WinOld, WinNew) -> boolean()
                           when
                               This :: wxSplitterWindow(),
                               WinOld :: wxWindow:wxWindow(),
                               WinNew :: wxWindow:wxWindow().

This function replaces one of the windows managed by the `wxSplitterWindow` with another one.

It is in general better to use it instead of calling `unsplit/2` and then resplitting the window back because it will provoke much less flicker (if any). It is valid to call this function whether the splitter has two windows or only one.

Both parameters should be non-NULL and `winOld` must specify one of the windows managed by the splitter. If the parameters are incorrect or the window couldn't be replaced, false is returned. Otherwise the function will return true, but please notice that it will not delete the replaced window and you may wish to do it yourself.

See: `getMinimumPaneSize/1`

Link to this function

# setMinimumPaneSize(This, PaneSize)

View Source

    -spec setMinimumPaneSize(This, PaneSize) -> ok when This :: wxSplitterWindow(), PaneSize :: integer().

Sets the minimum pane size.

Remark: The default minimum pane size is zero, which means that either pane can be reduced to zero by dragging the sash, thus removing one of the panes. To prevent this behaviour (and veto out-of-range sash dragging), set a minimum size, for example 20 pixels. If the wxSP_PERMIT_UNSPLIT style is used when a splitter window is created, the window may be unsplit even if minimum size is non-zero.

See: `getMinimumPaneSize/1`

Link to this function

# setSashGravity(This, Gravity)

View Source

    -spec setSashGravity(This, Gravity) -> ok when This :: wxSplitterWindow(), Gravity :: number().

Sets the sash gravity.

Remark: Gravity is real factor which controls position of sash while resizing `wxSplitterWindow`. Gravity tells `wxSplitterWindow` how much will left/top window grow while resizing. Example values:

- 0.0: only the bottom/right window is automatically resized

- 0.5: both windows grow by equal size

- 1.0: only left/top window grows Gravity should be a real value between 0.0 and 1.0. Default value of sash gravity is 0.0. That value is compatible with previous (before gravity was introduced) behaviour of `wxSplitterWindow`.

Notice that when sash gravity for a newly created splitter window, it is often necessary to explicitly set the splitter size using `wxWindow:setSize/6` to ensure that is big enough for its initial sash position. Otherwise, i.e. if the window is created with the default tiny size and only resized to its correct size later, the initial sash position will be affected by the gravity and typically result in sash being at the rightmost position for the gravity of 1. See the example code creating `wxSplitterWindow` in the splitter sample for more details.

See: `getSashGravity/1`

Link to this function

# setSashPosition(This, Position)

View Source

    -spec setSashPosition(This, Position) -> ok when This :: wxSplitterWindow(), Position :: integer().

Equivalent to `setSashPosition(This, Position, [])`.

Link to this function

# setSashPosition/3

View Source

    -spec setSashPosition(This, Position, [Option]) -> ok
                             when
                                 This :: wxSplitterWindow(),
                                 Position :: integer(),
                                 Option :: {redraw, boolean()}.

Sets the sash position.

Remark: Does not currently check for an out-of-range value.

See: `getSashPosition/1`

Link to this function

# setSplitMode(This, Mode)

View Source

    -spec setSplitMode(This, Mode) -> ok when This :: wxSplitterWindow(), Mode :: integer().

Sets the split mode.

Remark: Only sets the internal variable; does not update the display.

See:

- `getSplitMode/1`

- `splitVertically/4`

- `splitHorizontally/4`

Link to this function

# splitHorizontally(This, Window1, Window2)

View Source

    -spec splitHorizontally(This, Window1, Window2) -> boolean()
                               when
                                   This :: wxSplitterWindow(),
                                   Window1 :: wxWindow:wxWindow(),
                                   Window2 :: wxWindow:wxWindow().

Equivalent to `splitHorizontally(This, Window1, Window2, [])`.

Link to this function

# splitHorizontally/4

View Source

    -spec splitHorizontally(This, Window1, Window2, [Option]) -> boolean()
                               when
                                   This :: wxSplitterWindow(),
                                   Window1 :: wxWindow:wxWindow(),
                                   Window2 :: wxWindow:wxWindow(),
                                   Option :: {sashPosition, integer()}.

Initializes the top and bottom panes of the splitter window.

The child windows are shown if they are currently hidden.

Return: true if successful, false otherwise (the window was already split).

Remark: This should be called if you wish to initially view two panes. It can also be called at any subsequent time, but the application should check that the window is not currently split using `isSplit/1`.

See:

- `splitVertically/4`

- `isSplit/1`

- `unsplit/2`

Link to this function

# splitVertically(This, Window1, Window2)

View Source

    -spec splitVertically(This, Window1, Window2) -> boolean()
                             when
                                 This :: wxSplitterWindow(),
                                 Window1 :: wxWindow:wxWindow(),
                                 Window2 :: wxWindow:wxWindow().

Equivalent to `splitVertically(This, Window1, Window2, [])`.

Link to this function

# splitVertically/4

View Source

    -spec splitVertically(This, Window1, Window2, [Option]) -> boolean()
                             when
                                 This :: wxSplitterWindow(),
                                 Window1 :: wxWindow:wxWindow(),
                                 Window2 :: wxWindow:wxWindow(),
                                 Option :: {sashPosition, integer()}.

Initializes the left and right panes of the splitter window.

The child windows are shown if they are currently hidden.

Return: true if successful, false otherwise (the window was already split).

Remark: This should be called if you wish to initially view two panes. It can also be called at any subsequent time, but the application should check that the window is not currently split using `isSplit/1`.

See:

- `splitHorizontally/4`

- `isSplit/1`

- `unsplit/2`

Link to this function

# unsplit(This)

View Source

    -spec unsplit(This) -> boolean() when This :: wxSplitterWindow().

Equivalent to `unsplit(This, [])`.

Link to this function

# unsplit/2

View Source

    -spec unsplit(This, [Option]) -> boolean()
                     when This :: wxSplitterWindow(), Option :: {toRemove, wxWindow:wxWindow()}.

Unsplits the window.

Return: true if successful, false otherwise (the window was not split).

Remark: This call will not actually delete the pane being removed; it calls `OnUnsplit()` (not implemented in wx) which can be overridden for the desired behaviour. By default, the pane being removed is hidden.

See:

- `splitHorizontally/4`

- `splitVertically/4`

- `isSplit/1`

Link to this function

# updateSize(This)

View Source

    -spec updateSize(This) -> ok when This :: wxSplitterWindow().

Causes any pending sizing of the sash and child panes to take place immediately.

Such resizing normally takes place in idle time, in order to wait for layout to be completed. However, this can cause unacceptable flicker as the panes are resized after the window has been shown. To work around this, you can perform window layout (for example by sending a size event to the parent window), and then call this function, before showing the top-level window.