wxRuby Documentation Home

Wx::CollapsiblePane

A collapsible pane is a container with an embedded button-like control which can be used by the user to collapse or expand the pane’s contents.

Once constructed you should use the get_pane function to access the pane and add your controls inside it (i.e. use the get_pane return value as parent for the controls which must go in the pane, NOT the CollapsiblePane itself!).

Note that because of its nature of control which can dynamically (and drastically) change its size at run-time under user-input, when putting CollapsiblePane inside a Sizer you should be careful to add it with a proportion value of zero; this is because otherwise all other windows with non-null proportion values would automatically get resized each time the user expands or collapse the pane window resulting usually in a weird, flickering effect.

Usage sample:

coll_pane = Wx::CollapsiblePane.new(self, :label => 'Details)
 # add the pane with a zero proportion to the sizer which contains it
sizer.add(coll_pane, 0, Wx::GROW|Wx::ALL)
win = coll_pane.pane
sizer = Wx::BoxSizer(Wx::VERTICAL)
s_text = Wx::StaticText.new(win, :label => 'Test!')
sizer.add(s_text, 1, Wx::GROW|Wx::ALL, 2)
win.sizer = sizer
sizer.set_size_hints(pane)
# now add a test label in the collapsible pane, using a sizer for layout

Derived from

Control

Window

EvtHandler

Object

Window styles

CP_DEFAULT_STYLE The default style: 0.

Event handling

To process a collapsible pane event, use these event handler macros to direct input to member functions that take a CollapsiblePaneEvent argument.

evt_collapsiblepane_changed(id) { | event | ... } The user showed or hidden the collapsible pane.

See also

Panel,

CollapsiblePaneEvent

Methods

CollapsiblePane.new

CollapsiblePane.new(Window parent,  Integer id, 
                    String label, 
                    Point pos = DEFAULT_POSITION, 
                    Size size = DEFAULT_SIZE, 
                    Integer style = CP_DEFAULT_STYLE, 
                    Validator validator = DEFAULT_VALIDATOR, 
                   String name = "collapsiblePane")

Initializes the object and calls Create with all the parameters.

CollapsiblePane#create

Boolean create(Window parent,  Integer id,  String label, 
               Point pos = DEFAULT_POSITION, 
               Size size = DEFAULT_SIZE, 
               Integer style = CP_DEFAULT_STYLE, 
               Validator validator = DEFAULT_VALIDATOR, 
              String name = "collapsiblePane")

Parameters

Return value

if the control was successfully created or  if creation failed.

CollapsiblePane#is_collapsed

Boolean is_collapsed()

Returns if the pane window is currently hidden.

CollapsiblePane#is_expanded

Boolean is_expanded()

Returns if the pane window is currently shown.

CollapsiblePane#collapse

collapse(Boolean collapse = true)

Collapses or expands the pane window.

CollapsiblePane#expand

expand()

Same as <a href="collapsiblepanecollapse.html@@(false">Collapse</a>).

CollapsiblePane#get_pane

Window get_pane()

Returns a pointer to the pane window. Add controls to the returned Window to make them collapsible.

[This page automatically generated from the Textile source at Thu May 01 00:50:34 +0100 2008]