Wx::Panel
From WxPerl wiki
A panel is a window on which controls are placed. It is usually placed within a frame. It contains minimal extra functionality over and above its parent class Wx::Window; its main purpose is to be similar in appearance and functionality to a dialog, but with the flexibility of having any window as a parent.
Contents |
Inheritance
Wx::Panel derives from Wx::Window, Wx::EvtHandler, and Wx::Object;
Notes
By default, a panel has the same coloring as a dialog.
If you find that 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 keypreses for use by child controls.
Constructor
$panel = Wx::Panel->new($parent, $id, $pos, $size, $style, $name);
Parameters
- $parent — The parent of this control. Usually a Wx::Frame object, but it an be any window object.
- $id — An integer specifying the window identifier. Usually you will pass -1 to let the system assign an ID automatically.
- $pos — The window position, a reference to an array containing an x and a y coordinate. The special value [-1, -1] tells the system to choose the window's starting position.
- $size — The size of the window frame, a reference to an array containing a width and a height. The special value [-1, -1] tells the system to use a default size.
- $style — The button style to use. Optional.
- $name — The name of the button. This parameter is used to associate a name with the button, which allows certain windowing systems to search for the button by name, and allows X resources values to be applied to the button by name.
Methods
Create
$bool = $panel->Create(@options);
Used in something called "two-step frame construction". I have not been able to find details on what this is, or why it would be useful.
InitDialog
$panel->InitDialog;
Sends a Wx::InitDialogEvent, which transfers data to the dialog via validators.
OnSysColourChanged
sub OnSysColourChanged ($event) {...}
This is the default handler for the event Wx::EVT_SYS_COLOUR_CHANGED. It changes the panel's colors to conform to the current settings (Windows only). If you need the behavior to be different (for example, to keep a user-defined background color), you need to set up a handler for this event yourself. If you do handle this event, you should call Wx::Event::Skip to propagate the notification to child windows and controls.
Parameters
- $event — The color change event, a Wx::SysColorChangedEvent object.
SetFocus
$panel->SetFocus;
Overrides [[Wx::Window]::SetFocus. This method uses the (undocumented) mix-in class Wx::ControlContainer which manages the focus and TAB logic for controls that usually have child controls. In practice, if you call this method, and the panel has at least one child window, the focus will be given to the child window.
SetFocusIgnoringChildren
$panel->SetFocusIgnoringChildren;
In contrast to SetFocus (see above) this will set the focus to the panel even of there are child windows in the panel. This is only rarely needed.
