wxWindow
generated from ../src/mod_gui/control/window.cppwxWindow is the prototype of all objects based on wxWindow. This means that you can use all properties and methods in all those objects.
Constants
extraStyles
| Name | Description |
|---|---|
| WS_EX_VALIDATE_RECURSIVELY | TransferDataTo/FromWindow() and Validate() methods will recursively descend into all children of the window if it has this style flag set. |
| WS_EX_BLOCK_EVENTS | Normally, the command events are propagared upwards to the window parent recursively until a handler for them is found. Using this style allows to prevent them from being propagated beyond this window. Notice that wxDialog has this style on by default for the reasons explained in the event processing overview. |
| WS_EX_TRANSIENT | This can be used to prevent a window from being used as an implicit parent for the dialogs which were created without a parent. It is useful for the windows which can disappear at any moment as creating childs of such windows results in fatal problems. |
sizeFlags
| Name | Description |
|---|---|
| SIZE_AUTO_WIDTH | Use internally-calculated width if -1 |
| SIZE_AUTO_HEIGHT | Use internally-calculated height if -1 |
| SIZE_AUTO | Use internally-calculated width and height if each is -1 |
| SIZE_USE_EXISTING | Ignore missing (-1) dimensions (use existing). |
| SIZE_ALLOW_MINUS_ONE | Allow -1 as a valid position |
| SIZE_NO_ADJUSTMENTS | Don't do parent client adjustments (for implementation only) |
styles
| Name | Description |
|---|---|
| DOUBLE_BORDER | |
| SUNKEN_BORDER | |
| RAISED_BORDER | |
| BORDER | |
| SIMPLE_BORDER | |
| STATIC_BORDER | |
| NO_BORDER | |
| NO_3D | |
| CLIP_CHILDREN | |
| TAB_TRAVERSAL | |
| WANTS_CHARS | |
| NO_FULL_REPAINT_ON_RESIZE | |
| VSCROLL | |
| HSCROLL |
Class Properties
| Name | Type | Description |
|---|---|---|
capture ![]() |
wxWindow | Gets the window that has the capture. See hasCapture, releaseMouse and captureMouse |
Class Methods
findFocus
findFocus() : wxWindow
Finds the window or control which currently has the keyboard focus
findWindowById
findWindowById(Id) : wxWindow
| Name | Type | Default | Description |
|---|---|---|---|
| Id | Integer | The id of a window |
Find a window by identifier
findWindowByLabel
findWindowByLabel(Label) : wxWindow
| Name | Type | Default | Description |
|---|---|---|---|
| Label | String | The label of a window |
Find a window by label
Properties
| Name | Type | Description |
|---|---|---|
| acceleratorTable | wxAcceleratorTable | |
acceptsFocus ![]() |
Boolean | Can this window have focus? |
acceptsFocusFromKeyboard ![]() |
Boolean | can this window be given focus by keyboard navigation? if not, the only way to give it focus (provided it accepts it at all) is to click it |
| autoLayout | Boolean | Indicates whether the layout method must be called automatically or not when a window is resized. See wxSizer |
| backgroundColour | wxColour | Get/Set the background colour of the window |
bestSize ![]() |
wxSize | Gets the size best suited for the window |
| caret | wxCaret | Get/Set the caret. |
children ![]() |
Array | Gets a list of children |
clientAreaOrigin ![]() |
wxPoint | Get the origin of the client area of the window relative to the window top left corner (the client area may be shifted because of the borders, scrollbars, other decorations...) |
clientRect ![]() |
wxRect | Gets the rectangle of the client area |
| clientSize | wxSize | Get/Set the clientsize of the window. You can also use wxRect (only when setting) |
| enable | Boolean | Enables/Disables the window |
| extraStyle | Integer | Get/Set the extra window styles. See extraStyles |
| font | wxFont | Get/Set the font. |
| foregroundColour | wxColour | Get/Set the foreground colour of the window |
hasCapture ![]() |
Boolean | Returns true when this window has the capture. |
id ![]() |
Integer | Gets the unique id of the window, or -1 when it is not set. |
| parent | wxWindow | Get/Set the parent |
| position | wxPoint | Get/Set the position. |
rect ![]() |
wxRect | Gets the window rectangle |
shown ![]() |
Boolean | Returns true when the window is visible See visible property, show method |
| size | wxSize | Get/Set the size of the window. You can also use wxRect (only when setting) |
| sizer | wxSizer | Get/Set the sizer of the window. Set autoLayout to true when you want that the sizer is automatically used when the size of the window is changed. |
topLevel ![]() |
Boolean | Returns true when the window is a top level window. Currently all frames and dialogs are considered to be top-level windows (even if they have a parent window). |
| validator | wxValidator | Get/Set the validator of the window |
| visible | Boolean | Show/Hide the window. |
| windowStyle | Integer | Get/Set the window flag styles. Please note that some styles cannot be changed after the window creation and that refresh might be called after changing the others for the change to take place immediately. See styles |
Methods
captureMouse
captureMouse()
Directs all mouse input to this window. Call releaseMouse to release the capture. See hasCapture
centerOnParent
centerOnParent(Direction = wxOrientation.BOTH)
| Name | Type | Default | Description |
|---|---|---|---|
| Direction | Integer | wxOrientation.BOTH |
Centres the window based on the parent. centreOnParent is an alias for this method.
centre
centre(Direction = wxOrientation.BOTH)
| Name | Type | Default | Description |
|---|---|---|---|
| Direction | Integer | wxOrientation.BOTH | You can use the constants from wxOrientation |
clearBackground
clearBackground()
Clears the window by filling it with the current background color.
clientToScreen
clientToScreen(Point) : wxPoint
| Name | Type | Default | Description |
|---|---|---|---|
| Point | wxPoint | The client position |
Returns the screen coordinates from coordinates relative to this window.
close
close(Force = false)
| Name | Type | Default | Description |
|---|---|---|---|
| Force | Boolean | false | When true the application can't veto the close. By default Force is false. |
Closes the window. This applies only for wxFrame and wxDialog objects.
convertDialogToPixels
convertDialogToPixels(Point) : wxPoint
| Name | Type | Default | Description |
|---|---|---|---|
| Point | wxPoint | Converts a point |
convertDialogToPixels(Size) : wxSize
| Name | Type | Default | Description |
|---|---|---|---|
| Size | wxSize | Converts a size |
Converts a point or a size to from dialog units to pixels.
convertPixelsToDialog
convertPixelsToDialog(Point) : wxPoint
| Name | Type | Default | Description |
|---|---|---|---|
| Point | wxPoint | Converts a point |
convertPixelsToDialog(Size)
| Name | Type | Default | Description |
|---|---|---|---|
| Size | wxSize | Converts a size |
Converts a point or a size from pixels to dialog units.
destroy
destroy() : Boolean
Destroys the window. Returns true when the window is destroyed.
destroyChildren
destroyChildren()
Destroys all children of the window.
findWindow
findWindow(Id) : wxWindow
| Name | Type | Default | Description |
|---|---|---|---|
| Id | Integer | The id of a window |
findWindow(Name) : wxWindow
| Name | Type | Default | Description |
|---|---|---|---|
| Name | String | The name of a window |
Find a child of this window, by identifier or by name
fit
fit()
Set window size to wrap around its children
freeze
freeze()
Freeze the window: don't redraw it until it is thawed See thaw
initDialog
initDialog()
Sends an onInitDialog event, which in turn transfers data to the dialog via validators
layout
layout()
Layout the window using the sizer.
lower
lower()
Lowers the window to the bottom of the window hierarchy if it is a managed window (dialog or frame).
makeModal
makeModal(Flag = true)
| Name | Type | Default | Description |
|---|---|---|---|
| Flag | Boolean | true |
Make modal or not. When flag is true, all other windows are disabled.
move
move(X,
Y)
| Name | Type | Default | Description |
|---|---|---|---|
| X | Integer | ||
| Y | Integer |
move(Point)
| Name | Type | Default | Description |
|---|---|---|---|
| Point | wxPoint |
Moves the window.
raise
raise()
Raises the window to the top of the window hierarchy if it is a managed window (dialog or frame).
refresh
refresh(EraseBackGround = true,
Rect = null)
| Name | Type | Default | Description |
|---|---|---|---|
| EraseBackGround | Boolean | true | When true the background is erased. |
| Rect | wxRect | null | When set, the given rectangle will be treated as damaged. |
Generates an event for repainting the window
releaseMouse
releaseMouse()
Releases mouse input captured by captureMouse. See hasCapture and captureMouse
setClientSize
setClientSize(Width,
Height)
| Name | Type | Default | Description |
|---|---|---|---|
| Width | Integer | ||
| Height | Integer |
setClientSize(Size)
| Name | Type | Default | Description |
|---|---|---|---|
| Size | wxSize |
This sets the size of the window client area in pixels.
setFocus
setFocus()
This sets the window to receive keyboard input.
setSize
setSize(X,
Y,
Width,
Height,
Flag)
| Name | Type | Default | Description |
|---|---|---|---|
| X | Integer | X position in pixels, or -1 to indicate that the existing value should be used. | |
| Y | Integer | Y position in pixels, or -1 to indicate that the existing value should be used. | |
| Width | Integer | Width in pixels, or -1 to indicate that the existing value should be used. | |
| Height | Integer | Height in pixels, or -1 to indicate that the existing value should be used. | |
| Flag | Integer | Indicates the interpretation of the parameters. |
setSize(Width,
Height)
| Name | Type | Default | Description |
|---|---|---|---|
| Width | Integer | Width in pixels, or -1 to indicate that the existing value should be used. | |
| Height | Integer | Height in pixels, or -1 to indicate that the existing value should be used. |
Sets a new window size. See size property, sizeFlags
show
show(Visible = true)
| Name | Type | Default | Description |
|---|---|---|---|
| Visible | Boolean | true |
Shows (true) or hides (false) the window. See visible property, shown property
thaw
thaw()
Thaw the window: redraw it after it had been frozen. See freeze
transferDataFromWindow
transferDataFromWindow() : Boolean
Transfers values from child controls to data areas specified by their validators. Returns false if a transfer failed.
transferDataToWindow
transferDataToWindow() : Boolean
Transfers values to child controls from data areas specified by their validators Returns FALSE if a transfer failed.
update
update()
Repaint all invalid areas of the window immediately
validate
validate() : Boolean
Validates the current values of the child controls using their validators.
warpPointer
warpPointer(X,
Y)
| Name | Type | Default | Description |
|---|---|---|---|
| X | Integer | ||
| Y | Integer |
warpPointer(Point)
| Name | Type | Default | Description |
|---|---|---|---|
| Point | wxPoint |
Moves the mouse to the given position
Events
| onActivate | Called when the window is activated/disactivated. The function gets a wxActivateEvent as argument. |
| onChar | Called when the user enters a character. The function gets a wxKeyEvent object as argument. |
| onCharHook | This event is triggered to allow the window to intercept keyboard events before they are processed by child windows. The function gets a wxKeyEvent as argument. |
| onKeyDown | Called when the user has pressed a key, before it is translated into an ASCII value using other modifier keys that might be pressed at the same time. The function gets a wxKeyEvent object as argument. |
| onKeyUp | Called when the user has released the key. The function gets a wxKeyEvent object as argument. |
| onSetFocus | Called when the window gets the focus. The function gets a wxFocusEvent object as argument. |
| onKillFocus | Called when the window looses the focus. The function gets a wxFocusEvent object as argument. |
| onMouseEvents | Used for handling all the mouse events. The function gets a wxMouseEvent as argument. |
| onEnterWindow | Event triggered when the mouse enters the window. The function gets a wxMouseEvent as argument. Under Windows mouse enter and leave events are not natively supported by the system but are generated by wxWindows itself. This has several drawbacks: the onLeaveWindow event might be received some time after the mouse left the window and the state variables for it may have changed during this time. See onLeaveWindow |
| onLeaveWindow | Event triggered when the mouse leaves the window. The function gets a wxMouseEvent as argument. Under Windows mouse enter and leave events are not natively supported by the system but are generated by wxWindows itself. This has several drawbacks: the onLeaveWindow event might be received some time after the mouse left the window and the state variables for it may have changed during this time. See onEnterWindow |
| onLeftDown | Event triggered when the left button is pressed. The function gets a wxMouseEvent as argument. |
| onLeftUp | Event triggered when the left button is released. The function gets a wxMouseEvent as argument. |
| onLeftDClick | Event triggered when the left button is double clicked. The function gets a wxMouseEvent as argument. |
| onMiddleDown | Event triggered when the middle button is pressed. The function gets a wxMouseEvent as argument. |
| onMiddleUp | Event triggered when the middle button is released. The function gets a wxMouseEvent as argument. |
| onMiddleDClick | Event triggered when the middle button is double clicked. The function gets a wxMouseEvent as argument. |
| onRightDown | Event triggered when the right button is pressed. The function gets a wxMouseEvent as argument. |
| onRightUp | Event triggered when the right button is released. The function gets a wxMouseEvent as argument. |
| onRightDClick | Event triggered when the right button is double clicked. The function gets a wxMouseEvent as argument. |
| onMotion | Event triggered when the mouse is moved. The function gets a wxMouseEvent as argument. |
| onMouseWheel | Event triggered when the mousewheel is used. The function gets a wxMouseEvent as argument. |
| onMove | Called when the window is moved. The function gets a wxMoveEvent as argument. |
| onSize | Called when the window is resized. The function gets a wxSizeEvent as argument. |
| onScroll | Catch all scroll commands. The argument of the function is a wxScrollWinEvent. |
| onScrollTop | Catch a command to put the scroll thumb at the maximum position. The argument of the function is a wxScrollWinEvent. |
| onScrollBottom | Catch a command to put the scroll thumb at the maximum position. The argument of the function is a wxScrollWinEvent. |
| onScrollLineUp | Catch a line up command. The argument of the function is a wxScrollWinEvent. |
| onScrollLineDown | Catch a line down command. The argument of the function is a wxScrollWinEvent. |
| onScrollPageUp | Catch a page up command. The argument of the function is a wxScrollWinEvent. |
| onScrollPageDown | Catch a page down command. The argument of the function is a wxScrollWinEvent. |
| onScrollThumbTrack | Catch a thumbtrack command (continuous movement of the scroll thumb). The argument of the function is a wxScrollWinEvent. |
| onScrollThumbRelease | Catch a thumbtrack release command. The argument of the function is a wxScrollWinEvent. |
| onHelp | Triggered when the user pressed F1 (on Windows) or when the user requested context-sensitive help. The argument of the function is a wxHelpEvent. See wxContextHelp, wxHelpEvent and wxContextHelpButton |

© 2002 - 2007 Franky Braem.