Search documentation of wx

# wxPanel (wx v2.6)

Copy Markdown View Source

A panel is a window on which controls are placed.

It is usually placed within a frame. Its main feature over its parent class `wxWindow` is code for handling child windows and TAB traversal, which is implemented natively if possible (e.g. in wxGTK) or by wxWidgets itself otherwise.

Note: Tab traversal is implemented through an otherwise undocumented intermediate wxControlContainer class from which any class can derive in addition to the normal `wxWindow` base class. Please see and to find out how this is achieved.

Note: if not all characters are being intercepted by your OnKeyDown or OnChar handler, it may be because you are using the `wxTAB_TRAVERSAL` style, which grabs some keypresses for use by child controls.

Remark: By default, a panel has the same colouring as a dialog.

See: `wxDialog`

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

- `wxWindow`

- `wxEvtHandler`

wxWidgets docs: wxPanel

## Events

Event types emitted from this class:

- `navigation_key`

## Summary

### Types

wxPanel()

### Functions

destroy(This)

Destroys the object

initDialog(This)

Sends a `wxInitDialogEvent`, which in turn transfers data to the dialog via validators.

new()

Default constructor.

new(Parent)

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

new/2

Constructor.

setFocusIgnoringChildren(This)

In contrast to `wxWindow:setFocus/1` (see above) this will set the focus to the panel even if there are child windows in the panel.

## Types

# wxPanel()

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

## Functions

# destroy(This)

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

Destroys the object

# initDialog(This)

    -spec initDialog(This) -> ok when This :: wxPanel().

Sends a `wxInitDialogEvent`, which in turn transfers data to the dialog via validators.

See: `wxInitDialogEvent`

# new()

    -spec new() -> wxPanel().

Default constructor.

# new(Parent)

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

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

# new/2

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

Constructor.

# setFocusIgnoringChildren(This)

    -spec setFocusIgnoringChildren(This) -> ok when This :: wxPanel().

In contrast to `wxWindow:setFocus/1` (see above) this will set the focus to the panel even if there are child windows in the panel.

This is only rarely needed.