wxWindow(3)

๐Ÿ“ฆ
version 29.0.6 ยท 3 versions
, in ubuntu stonking

wxWindow ๐Ÿ’–

Erlang Module Definition โ€” welcome to the group chat, bestie, this is the manual page for wxWindow.


โœจ NAME โœจ

wxWindow โ€” it's the base class for all windows, and it represents literally any visible object on your screen. yes, any. iconic behavior.


๐ŸŒธ DESCRIPTION ๐ŸŒธ

okay so listen. every control you've ever met? every top level window? all of them are windows. all of them. sizers and device contexts are not windows though โ€” they don't show up on screen themselves, so they don't count. they're like the backstage crew. important, but not on the poster. ๐Ÿ’…

now, a very important heads up: all the children of the window get deleted automatically by the destructor before the window itself is deleted. which means โ€” and this is the slay part โ€” you do not have to worry about deleting them manually. periodt. if you want the whole story, go read the window deletion overview. ๐Ÿ“–

also! and this is a thing across this class and many other wxWidgets classes: some GetXXX() methods might be overloaded (looking at you, getSize/1 and getClientSize/1 ๐Ÿ‘€). when that happens, the overloads are non-virtual, because having multiple virtual functions with the same name gets you virtual function name hiding at the derived class level. in plain English, bestie: the derived class has to override all the overloaded variants if it wants to override any of them. ๐Ÿ˜ญ to make that less cursed, wxWidgets uses a unique protected virtual DoGetXXX() method and forwards all the GetXXX() ones to it โ€” so if you override the former, you change the behaviour of the latter. that's the whole trick. โœจ

๐ŸŒˆ Styles

this class supports these styles, and you're gonna want to know all of them:

  • wxBORDER_DEFAULT: the window class decides what kind of border to show, if any. let it cook. ๐Ÿ‘‘
  • wxBORDER_SIMPLE: shows a thin border around the window. wxSIMPLE_BORDER is the old name for this style.
  • wxBORDER_SUNKEN: shows a sunken border. wxSUNKEN_BORDER is the old name for this style.
  • wxBORDER_RAISED: shows a raised border. wxRAISED_BORDER is the old name for this style.
  • wxBORDER_STATIC: shows a border that's suitable for a static control. wxSTATIC_BORDER is the old name for this style. Windows only.
  • wxBORDER_THEME: shows a native border that's suitable for a control, on the current platform. on Windows this is a themed border; on most other platforms a sunken border gets used. for more info about themed borders on Windows, go look at Themed borders on Windows.
  • wxBORDER_NONE: shows no border at all, overriding the default border style for the window. wxNO_BORDER is the old name for this style.
  • wxBORDER_DOUBLE: this style is obsolete and should not be used. ๐Ÿ’€ don't.
  • wxTRANSPARENT_WINDOW: the window is transparent, meaning it will not receive paint events. Windows only.
  • wxTAB_TRAVERSAL: wxWidgets uses this style for windows that support TAB navigation among their children, like wxDialog and wxPanel. it should almost never be used in application code. fr fr, hands off. ๐Ÿ™ˆ
  • wxWANTS_CHARS: use this to say the window wants to get all char/key events for all keys โ€” even for keys like TAB or ENTER, which are usually used for dialog navigation and which wouldn't even be generated without this style. if you need this style to get the arrows or whatever, but you still want normal keyboard navigation to happen, you should call Navigate in response to the key events for Tab and Shift-Tab. โœจ
  • wxNO_FULL_REPAINT_ON_RESIZE: on Windows, this style used to disable repainting the window completely when its size changed. since that behaviour is now the default, this style is now obsolete and no longer has any effect. rip. ๐Ÿชฆ
  • wxVSCROLL: use this style to enable a vertical scrollbar. heads up though โ€” this style can't be used with native controls that don't support scrollbars, nor with top-level windows in most ports.
  • wxHSCROLL: use this style to enable a horizontal scrollbar. same limitations as wxVSCROLL apply here.
  • wxALWAYS_SHOW_SB: if a window has scrollbars, disable them instead of hiding them when they're not needed (i.e. when the window is big enough that it doesn't need the scrollbars to navigate it). this style is currently implemented for wxMSW, wxGTK and wxUniversal, and it does nothing on the other platforms. ๐Ÿคท
  • wxCLIP_CHILDREN: use this style to eliminate flicker caused by the background being repainted, then children being painted over them. Windows only.
  • wxFULL_REPAINT_ON_RESIZE: use this style to force a complete redraw of the window whenever it's resized, instead of just redrawing the part of the window affected by the resizing. note that this was the default behaviour before the 2.5.1 release, and if you're hitting redraw problems with code that used to work, you might want to try this. currently this style applies on GTK+ 2 and Windows only, and full repainting is always done on other platforms. ๐Ÿ’–

๐Ÿฆ‹ Extra Styles

this class supports these extra styles too:

  • wxWS_EX_BLOCK_EVENTS: wxCommandEvents and the objects of the derived classes are forwarded to the parent window and so on recursively by default. using this flag on a given window lets you block this propagation at this window โ€” i.e. stop the events from being propagated further upwards. dialogs have this flag on by default, for the reasons explained in the overview_events.
  • wxWS_EX_TRANSIENT: don't use this window as an implicit parent for the other windows โ€” this must be used with transient windows, because otherwise there's the risk of creating a dialog/frame with this window as a parent, which would lead to a crash if the parent got destroyed before the child. ๐Ÿ˜ญ be careful, bestie.
  • wxWS_EX_CONTEXTHELP: under Windows, puts a query button on the caption. when pressed, Windows goes into a context-sensitive help mode and wxWidgets sends a wxEVT_HELP event if the user clicked on an application window. this style cannot be used (because of the underlying native behaviour) together with wxMAXIMIZE_BOX or wxMINIMIZE_BOX, so those two styles get automatically turned off if this one is used.
  • wxWS_EX_PROCESS_IDLE: this window should always process idle events, even if the mode set by wxIdleEvent:setMode/1 is wxIDLE_PROCESS_SPECIFIED.
  • wxWS_EX_PROCESS_UI_UPDATES: this window should always process UI update events, even if the mode set by wxUpdateUIEvent:setMode/1 is wxUPDATE_UI_PROCESS_SPECIFIED.

See also, bestie:

  • Overview events
  • Overview windowsizing

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

  • wxEvtHandler

wxWidgets docs: wxWindow

๐ŸŽ€ Events

event types emitted from this class:

  • activate
  • child_focus
  • context_menu
  • help
  • drop_files
  • erase_background
  • set_focus
  • kill_focus
  • idle
  • joy_button_down
  • joy_button_up
  • joy_move
  • joy_zmove
  • key_down
  • key_up
  • char
  • char_hook
  • mouse_capture_lost
  • mouse_capture_changed
  • left_down
  • left_up
  • middle_down
  • middle_up
  • right_down
  • right_up
  • motion
  • enter_window
  • leave_window
  • left_dclick
  • middle_dclick
  • right_dclick
  • mousewheel
  • aux1_down
  • aux1_up
  • aux1_dclick
  • aux2_down
  • aux2_up
  • aux2_dclick
  • paint
  • scrollwin_top
  • scrollwin_bottom
  • scrollwin_lineup
  • scrollwin_linedown
  • scrollwin_pageup
  • scrollwin_pagedown
  • scrollwin_thumbtrack
  • scrollwin_thumbrelease
  • set_cursor
  • size
  • sys_colour_changed

๐Ÿ’œ DATA TYPES ๐Ÿ’œ

wxWindow() :: wx:wx_object().

โญ FUNCTIONS โญ

'Destroy'(This) -> boolean()

'Destroy'(This) -> boolean() when This :: wxWindow().

destroys the window safely. ๐Ÿซถ

use this function instead of the delete operator, because different window classes can be destroyed differently. frames and dialogs are not destroyed immediately when this function is called โ€” they get added to a list of windows to be deleted on idle time, when all the window's events have been processed. that's what prevents the whole "events being sent to non-existent windows" problem. chef's kiss design honestly. ๐Ÿ’…

Return: true if the window has either been successfully deleted, or it's been added to the list of windows pending real deletion.

cacheBestSize(This, Size) -> ok

cacheBestSize(This, Size) -> ok
                          when
                              This :: wxWindow(),
                              Size :: {W :: integer(), H :: integer()}.

sets the cached best size value.

See: getBestSize/1

canSetTransparent(This) -> boolean()

canSetTransparent(This) -> boolean() when This :: wxWindow().

returns true if the system supports transparent windows and calling setTransparent/2 may succeed. โœจ

if this function returns false, transparent windows are definitely not supported by the current system. no cap.

captureMouse(This) -> ok

captureMouse(This) -> ok when This :: wxWindow().

directs all mouse input to this window. ๐Ÿ‘‘

call releaseMouse/1 to release the capture.

okay this part matters, so pay attention bestie: wxWidgets maintains a stack of windows that have captured the mouse, and when the mouse is released the capture returns to the window that had captured it previously โ€” and it's only really released if there were no previous window. in particular, this means you must release the mouse as many times as you capture it, unless the window receives the wxMouseCaptureLostEvent event.

any application that captures the mouse at the beginning of some operation must handle wxMouseCaptureLostEvent and cancel that operation when it receives the event. the event handler must not recapture mouse. don't do it. ๐Ÿšซ

See:

  • releaseMouse/1
  • wxMouseCaptureLostEvent

center(This, [Option]) -> ok

center(This, [Option]) -> ok
                when This :: wxWindow(), Option :: {dir, integer()}.

equivalent to: centre/2

centerOnParent(This, [Option]) -> ok

centerOnParent(This, [Option]) -> ok
                        when
                            This :: wxWindow(),
                            Option :: {dir, integer()}.

equivalent to: centreOnParent/2

centre(This, [Option]) -> ok

centre(This, [Option]) -> ok
                when This :: wxWindow(), Option :: {dir, integer()}.

centres the window. ๐ŸŽฏ

Remark: if the window is a top level one (i.e. it doesn't have a parent), it will be centred relative to the screen anyhow. it's giving "main character energy" โ€” it centres itself regardless.

See: center/2

centreOnParent(This, [Option]) -> ok

centreOnParent(This, [Option]) -> ok
                        when
                            This :: wxWindow(),
                            Option :: {dir, integer()}.

centres the window on its parent. ๐Ÿฆ‹


okay this one is just the more readable synonym for centre/2. ๐Ÿ’… Same thing, cuter label, no notes.

Remark: this method is your girl for centring top level windows over their parents instead of over the whole entire screen ๐ŸŒธ. If there's no parent, or the window isn't a top level window, then it behaves exactly like centre/2. No surprises, no drama.

See: wxTopLevelWindow:centreOnScreen/2


clearBackground

clearBackground(This) -> ok when This :: wxWindow().

Clears the window by filling it with the current background colour. That's the whole job. ๐Ÿงผ

It does not cause an erase background event to be generated. Nope, not that one, don't @ me.

โš ๏ธ Notice bestie: this uses wxClientDC to draw on the window, and the results of doing it while you're also drawing on wxPaintDC for this window are undefined ๐Ÿ’€. So this method shouldn't be used from EVT_PAINT handlers โ€” just use wxDC:clear/1 on the wxPaintDC you already use there instead. Simple as that.

clientToScreen

clientToScreen(This, Pt) -> {X :: integer(), Y :: integer()}
                        when
                            This :: wxWindow(),
                            Pt :: {X :: integer(), Y :: integer()}.

Converts to screen coordinates from coordinates relative to this window. โœจ


clientToScreen

clientToScreen(This, X, Y) -> {X :: integer(), Y :: integer()}
                        when
                            This :: wxWindow(),
                            X :: integer(),
                            Y :: integer().

Same deal, twin sister ๐Ÿ’– โ€” converts to screen coordinates from coordinates relative to this window.


close

close(This, [Option]) -> boolean()
               when This :: wxWindow(), Option :: {force, boolean()}.

This function simply generates a wxCloseEvent whose handler usually tries to close the window.

It doesn't close the window itself, though. Not me expecting close to actually close things ๐Ÿ˜ญ iconic behaviour honestly.

Return: true if the event was handled and not vetoed, false otherwise.

Remark: Close calls the close handler for the window, which gives the window a lil opportunity to choose whether to destroy itself or not. Usually it's only used with the top level windows (wxFrame and wxDialog classes) because the others aren't supposed to have any special OnClose() logic. The close handler should check whether the window is being deleted forcibly, using wxCloseEvent:canVeto/1, in which case it should destroy the window using 'Destroy'/1. Note that calling Close does not guarantee that the window will be destroyed ๐Ÿซ ; but it does give you a way to simulate a manual close of a window, which may or may not be implemented by destroying the window. The default implementation of wxDialog::OnCloseWindow does not necessarily delete the dialog, since it will simply simulate a wxID_CANCEL event which is handled by the appropriate button event handler and may do anything at all. To guarantee that the window will be destroyed, call 'Destroy'/1 instead. periodt.

See:

  • 'Destroy'/1
  • wxCloseEvent

convertDialogToPixels

convertDialogToPixels(This, Sz) ->
                                {W :: integer(), H :: integer()}
                                when
                                    This :: wxWindow(),
                                    Sz ::
                                        {W :: integer(), H :: integer()}.

aww, this is an overloaded member function, provided for convenience ๐ŸŽ€ it differs from the above function only in what argument(s) it accepts.


convertPixelsToDialog

convertPixelsToDialog(This, Sz) ->
                                {W :: integer(), H :: integer()}
                                when
                                    This :: wxWindow(),
                                    Sz ::
                                        {W :: integer(), H :: integer()}.

and this one is also an overloaded member function, provided for convenience ๐ŸŽ€ it too differs from the above function only in what argument(s) it accepts.


create

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

Construct the actual window object after creating the C++ object. Two-step girlie behaviour, we love her. โœจ

The non-default constructor of wxWindow class does two things: it initializes the C++ object and it also creates the window object in the underlying graphical toolkit. The create/4 method can be used to perform the second part later, while the default constructor can be used to perform the first part only.

๐Ÿšจ Please note that the underlying window must be created exactly once. Like, one time. i.e. if you use the default constructor, which doesn't do this, you must call create/4 before using the window; and if you use the non-default constructor, you can not call create/4, because the underlying window is already created. No double-dipping bestie ๐Ÿ’…

Note that it's possible โ€” and, in fact, useful โ€” to call some methods on the object between creating the C++ object itself and calling create/4 on it, e.g. a common pattern to avoid showing the contents of a window before it is fully initialized is:

(the page just leaves you hanging right there โ€” no snippet, that's literally all it says ๐Ÿ™ˆ)

Also note that it's possible to create an object of a derived type and then call create/4 on it: this is notably used by overview_xrc.

The parameters of this method have exactly the same meaning as the non-default constructor parameters, please refer to them for their description.

Return: true if window creation succeeded or false if it failed.


destroy

destroy(This :: wxWindow()) -> ok.

Destroys the object. ๐Ÿ’€ That's it, that's the tweet.


destroyChildren

destroyChildren(This) -> boolean() when This :: wxWindow().

Destroys all children of a window. ๐Ÿ˜ญ your faves are gone.

Called automatically by the destructor.


disable

disable(This) -> boolean() when This :: wxWindow().

Disables the window. Same as enable/2 Enable(false).

Return: Returns true if the window has been disabled, false if it had been already disabled before the call to this function. (Yeah, she'll tell you if you were already there. Not judgemental, just honest ๐Ÿ’…)


dragAcceptFiles

dragAcceptFiles(This, Accept) -> ok
                         when This :: wxWindow(), Accept :: boolean().

Enables or disables eligibility for drop file events (OnDropFiles). ๐Ÿ“ drag, drop, slay.

Remark: Windows only until version 2.8.9, available on all platforms since 2.8.10. Cannot be used together with setDropTarget/2 on non-Windows platforms. ๐Ÿšซ

See: setDropTarget/2


enable

enable(This, [Option]) -> boolean()
                when This :: wxWindow(), Option :: {enable, boolean()}.

Enable or disable the window for user input. ๐ŸŽ€

Note that when a parent window is disabled, all of its children are disabled as well โ€” and they are re-enabled again when the parent is. Generational trauma but for widgets, iykyk ๐Ÿ˜ญ

A window can be created initially disabled by calling this method on it before calling create/4 to create the actual underlying window, e.g.

(again โ€” that trailing "e.g." is all she wrote. The page does not actually show you the example ๐Ÿ™ˆ)

Return: Returns true if the window has been enabled or disabled, false if nothing was done, i.e. if the window had already been in the specified state.

See:

  • isEnabled/1
  • disable/1
  • wxRadioBox:enable/3

findFocus

findFocus() -> wxWindow().

Finds the window or control which currently has the keyboard focus. ๐Ÿ‘‘ main character energy detected.

Remark: Note that this is a static function, so it can be called without needing a wxWindow pointer. No This, no problem. ๐Ÿ’…

See: setFocus/1


findWindow

findWindow(This, Id) -> wxWindow()
                    when This :: wxWindow(), Id :: integer();
                (This, Name) -> wxWindow()
                    when This :: wxWindow(), Name :: unicode:chardata().

Find a child of this window, by name.

May return This if it matches itself. She contains multitudes. ๐ŸŒˆ

Notice that only real children, not top level windows using this window as parent, are searched by this function. Family only. ๐Ÿ™ˆ


findWindowById

findWindowById(Id, [Option]) -> wxWindow()
                        when
                            Id :: integer(),
                            Option :: {parent, wxWindow()}.

Find the first window with the given id. ๐ŸŽฏ

If parent is NULL, the search will start from all top-level frames and dialog boxes; if non-NULL, the search will be limited to the given window hierarchy. The search is recursive in both cases. go deeper bestie ๐ŸŒŠ

See: findWindow/2

Return: Window with the given id or NULL if not found.


findWindowByLabel

findWindowByLabel(Label, [Option]) -> wxWindow()
                           when
                               Label :: unicode:chardata(),
                               Option :: {parent, wxWindow()}.

Find a window by its label. ๐Ÿท๏ธ

Depending on the type of window, the label may be a window title or a panel item label. If parent is NULL, the search will start from all top-level frames and dialog boxes; if non-NULL, the search will be limited to the given window hierarchy.

The search is recursive in both cases and, unlike with findWindow/2, recurses into top level child windows too. She's thorough like that ๐Ÿ’…

See: findWindow/2

Return: Window with the given label or NULL if not found.


findWindowByName

findWindowByName(Name, [Option]) -> wxWindow()
                          when
                              Name :: unicode:chardata(),
                              Option :: {parent, wxWindow()}.

Find a window by its name (as given in a window constructor or create/4 function call). โœจ

If parent is NULL, the search will start from all top-level frames and dialog boxes; if non-NULL, the search will be limited to the given window hierarchy.

The search is recursive in both cases and, unlike findWindow/2, recurses into top level child windows too.

If no window with such name is found, findWindowByLabel/2 is called โ€” i.e. the name is interpreted as (internal) name first, but if this fails, it's interpreted as (user-visible) label. As this behaviour may be confusing ๐Ÿซ , it is usually better to use either the findWindow/2 overload taking the name or findWindowByLabel/2 directly.

Return: Window with the given name or NULL if not found.


fit

fit(This) -> ok when This :: wxWindow().

Sizes the window to fit its best size. ๐ŸŽ€ snug as a bug.

Using this function is equivalent to setting window size to the return value of getBestSize/1.

Okay so real talk โ€” fit/1 changes the current window size only, it does not touch the minimal size. Unlike setSizerAndFit/3, which does both. Noted. ๐Ÿ’…

See: Overview windowsizing


fitInside/1

fitInside(This) -> ok when This :: wxWindow().

Basically fit/1's little sister, except she sizes the interior (virtual) size of a window instead. ๐ŸŒธ

Where is this actually the move? Scrolled windows, bestie. It's for resetting scrollbars after sizing changes that don't trigger a size event, and/or for scrolled windows that don't have an interior sizer at all. And โ€” same energy as fit/1 โ€” if there are no subwindows, this function won't do anything. Nada. Zero. ๐Ÿ™ˆ


freeze/1

freeze(This) -> ok when This :: wxWindow().

Freezes the window. Icy. โ„๏ธ Translation: it prevents any updates from taking place on screen โ€” the window is not redrawn at all.

To bring it back to life you gotta call thaw/1. And listen โ€” calls to these two can be nested, but to make sure the window actually repaints properly again, you must thaw it exactly as many times as you froze it. Count them. Keep receipts. ๐Ÿงพ

If the window has any children, they get recursively frozen too. Whole family on ice.

It's a visual appearance optimization (like, it's genuinely a good idea to use it before doing many large text insertions in a row into a wxTextCtrl under wxGTK), but it is not implemented on all platforms nor for all controls โ€” so it's mostly just a hint to wxWidgets, not a mandatory directive. Lowkey a suggestion, highkey not a law. โœจ

See:

  • thaw/1
  • isFrozen/1

fromDIP/2

fromDIP(D, W) -> integer() when D :: integer(), W :: wxWindow();
             (Sz, W) -> {W :: integer(), H :: integer()}
                 when
                     Sz :: {W :: integer(), H :: integer()},
                     W :: wxWindow();
             (This, D) -> integer()
                 when This :: wxWindow(), D :: integer();
             (This, Sz) -> {W :: integer(), H :: integer()}
                 when
                     This :: wxWindow(),
                     Sz :: {W :: integer(), H :: integer()}.

Converts DPI-independent pixel values into the actual pixel values appropriate for the current toolkit. ๐Ÿ–ฅ๏ธโœจ

So a DPI-independent pixel is just a pixel at the standard 96 DPI resolution. To keep the same physical size at higher resolution, the physical pixel value must be scaled by getDPIScaleFactor/1 โ€” though that scaling may already be done for you by the underlying toolkit (GTK+, Cocoa, ...) automatically. This method only performs the conversion if it isn't already done by the lower level toolkit, so by using it with pixel values you can guarantee that the physical size of the corresponding elements stays the same in all resolutions under all platforms. For example, instead of creating a bitmap of the hard coded size of 32 pixels you should use to avoid using tiny bitmaps on high DPI screens. (Yeah, the source doc literally trails off there โ€” the code sample did not survive the journey. Not us. ๐Ÿ˜ญ)

Notice that this function is only needed when using hard coded pixel values. It is not necessary if the sizes are already based on DPI-independent units like dialog units, or if you're relying on the controls' automatic best size determination and using sizers to lay them out.

Also โ€” if either component of sz has the special value of -1, it comes back unchanged, independently of the current DPI. That's on purpose: it preserves the special value of -1 in wxWidgets API, since it's often used to mean "unspecified". ๐ŸŽ€

Since: 3.1.0


getAcceleratorTable/1

getAcceleratorTable(This) ->
                         wxAcceleratorTable:wxAcceleratorTable()
                         when This :: wxWindow().

Gets the accelerator table for this window. โŒจ๏ธ๐Ÿ’จ

See: wxAcceleratorTable.


getBackgroundColour/1

getBackgroundColour(This) -> wx:wx_colour4()
                             when This :: wxWindow().

Returns the background colour of the window. ๐ŸŽจ

See:

  • setBackgroundColour/2
  • setForegroundColour/2
  • getForegroundColour/1

getBackgroundStyle/1

getBackgroundStyle(This) -> wx:wx_enum() when This :: wxWindow().

Returns the background style of the window. The vibe of the background. ๐ŸŒˆ

See:

  • setBackgroundColour/2
  • getForegroundColour/1
  • setBackgroundStyle/2
  • setTransparent/2

getBestSize/1

getBestSize(This) -> {W :: integer(), H :: integer()}
                     when This :: wxWindow().

This function returns the best acceptable minimal size for the window. It's giving "what size do you want to be". ๐Ÿ‘‘

Like, for a static control, it'll be the minimal size such that the control's label isn't truncated. For windows containing subwindows (typically wxPanel), the size returned here will be the same as the size the window would have had after calling fit/1.

If you're writing your own custom window class and you want to change the value this public non-virtual method returns, override the virtual DoGetBestSize() (not implemented in wx) or โ€” better, because it's usually more convenient โ€” DoGetBestClientSize() (not implemented in wx).

Notice that the best size respects the minimal and maximal size explicitly set for the window, if any. So even if some window believes it needs 200 pixels horizontally, calling setMaxSize/2 with a width of 100 would ensure that getBestSize/1 returns a width of at most 100 pixels. The cap is the cap. ๐Ÿ’€

See:

  • cacheBestSize/2
  • Overview windowsizing

getCapture/1

getCapture() -> wxWindow().

Returns the currently captured window. Caught it. ๐Ÿซณ

See:

  • hasCapture/1
  • captureMouse/1
  • releaseMouse/1
  • wxMouseCaptureLostEvent
  • wxMouseCaptureChangedEvent

getCaret/1

getCaret(This) -> wxCaret:wxCaret() when This :: wxWindow().

Returns the caret() associated with the window. Blink blink. โœจ


getCharHeight/1

getCharHeight(This) -> integer() when This :: wxWindow().

Returns the character height for this window.


getCharWidth/1

getCharWidth(This) -> integer() when This :: wxWindow().

Returns the average character width for this window.


getChildren/1

getChildren(This) -> [wxWindow()] when This :: wxWindow().

Returns a const reference to the list of the window's children. The whole lil squad. ๐Ÿซถ

wxWindowList is a type-safe wxList-like class whose elements are of type wxWindow*.


getClientSize/1

getClientSize(This) -> {W :: integer(), H :: integer()}
                       when This :: wxWindow().

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. (That's it, that's the whole note. Take it up with the docs. ๐Ÿ’…)


getContainingSizer/1

getContainingSizer(This) -> wxSizer:wxSizer()
                            when This :: wxWindow().

Returns the sizer of which this window is a member, if any โ€” otherwise NULL. No sizer? No tea. ๐Ÿต


getContentScaleFactor/1

getContentScaleFactor(This) -> number() when This :: wxWindow().

Returns the factor mapping logical pixels of this window to physical pixels.

You can use this to portably figure out how many physical pixels live in a window of a given size, by multiplying the window size by the value returned from it. I.e. it returns the factor converting window coordinates to "content view" coordinates, where the view can be just a simple window displaying a wxBitmap or wxGLCanvas or any other kind of window rendering arbitrary "content" on screen. ๐Ÿ–ผ๏ธ

For platforms that don't do any pixel mapping โ€” i.e. where logical and physical pixels are one and the same โ€” this function always returns 1.0. So using it is, in principle, unnecessary and could be avoided by using a preprocessor check for wxHAVE_DPI_INDEPENDENT_PIXELS not being defined. However, using this function unconditionally under all platforms is usually simpler and so preferable. Simpler > clever. โœจ

Note: Current behaviour of this function is compatible with wxWidgets 3.0, but different from its behaviour in versions 3.1.0 to 3.1.3, where it returned the same value as getDPIScaleFactor/1. Please use the other function if you need to use a scaling factor greater than 1.0 even for the platforms without wxHAVE_DPI_INDEPENDENT_PIXELS, such as wxMSW.

Since: 2.9.5


getCursor/1

getCursor(This) -> wxCursor:wxCursor() when This :: wxWindow().

Returns the cursor associated with this window. Where the little arrow lives. ๐Ÿญ

See: setCursor/2


getDPI/1

getDPI(This) -> {W :: integer(), H :: integer()}
                when This :: wxWindow().

Returns the DPI of the display used by this window. ๐Ÿ“

Heads up: the returned value can be different for different windows on systems with support for per-monitor DPI values, such as Microsoft Windows 10. So don't go assuming one DPI for the whole app.

If the DPI is not available, it returns a {Width,Height} object.

See: wxDisplay:getPPI/1

Since: 3.1.3


getDPIScaleFactor/1

getDPIScaleFactor(This) -> number() when This :: wxWindow().

Returns the ratio of the DPI used by this window to the standard DPI. ๐Ÿ“

The returned value is 1 for standard DPI screens, or 2 for "200% scaling" โ€” and unlike getContentScaleFactor/1, it's the same under all platforms.

You should use this factor to increase the size of icons and similar windows whose best size is not based on text metrics when using DPI scaling.

E.g. the program may load a 32px bitmap if the content scale factor is 1.0, or the 64px version of the same bitmap if it is 2.0 or bigger.

Notice that this method should not be used for window sizes expressed in pixels, since they're already scaled by this factor by the underlying toolkit on some platforms. Use fromDIP/2 for anything window-related instead. ๐Ÿซถ

Since: 3.1.4


getDropTarget/1

getDropTarget(This) -> wx:wx_object() when This :: wxWindow().

Returns the associated drop target โ€” which may be NULL. Drag it, drop it. ๐ŸŽฏ

See:

  • setDropTarget/2
  • Overview dnd

getExtraStyle/1

getExtraStyle(This) -> integer() when This :: wxWindow().

Returns the extra style bits for the window. Extra. Like the name says. โœจ


getFont/1

getFont(This) -> wxFont:wxFont() when This :: wxWindow().

Returns the font for this window. Typography check. ๐Ÿ”ค

See: setFont/2


getForegroundColour/1

getForegroundColour(This) -> wx:wx_colour4()
                             when This :: wxWindow().

Returns the foreground colour of the window.

Remark: The meaning of foreground colour varies according to the window class โ€” it may be the text colour or some other colour, or it may not be used at all. So, like, read the room per-class. ๐Ÿ’…

See:

  • setForegroundColour/2
  • setBackgroundColour/2
  • getBackgroundColour/1

getGrandParent/1

getGrandParent(This) -> wxWindow() when This :: wxWindow().

Hands you the grandparent of a window ๐Ÿซถ โ€” yes bestie, we're going up the whole family tree. If there isn't one, you get NULL. That's the whole function, we love a short queen. ๐Ÿ‘‘

getHandle/1

getHandle(This) -> integer() when This :: wxWindow().

Returns the platform-specific handle of the physical window โ€” like, its actual legal name instead of its nickname. You cast it to whatever handle type your platform speaks: HWND for Windows, Widget for Motif, or GtkWidget for GTK. So very "here's my real ID, no cap". ๐Ÿ’…

getHelpText/1

getHelpText(This) -> unicode:charlist() when This :: wxWindow().

Gets the help text that gets used as context-sensitive help for this window. โœจ

Heads up bestie: the text isn't actually stored in the window object itself โ€” it lives in the current wxHelpProvider implementation, and that one is (not implemented in wx). So the window is just borrowing the vibe. ๐Ÿ™ˆ

See: setHelpText/2

getId/1

getId(This) -> integer() when This :: wxWindow().

Returns the identifier of the window. ๐ŸŽ€

Remark: every window has an integer identifier, periodt. If the application never provided one (or handed over the default wxID_ANY), a unique identifier gets generated for you โ€” and it'll have a negative value. Surprise! ๐Ÿ˜ญ

See:

  • setId/2
  • Overview windowids

getLabel/1

getLabel(This) -> unicode:charlist() when This :: wxWindow().

The generic way to pull a label off any window, purely for identification purposes. ๐ŸŒธ

Remark: the way this function reads the room is different from class to class. For frames and dialogs, the value you get back is the title. For buttons or static text controls, it's the button text. It's genuinely useful for meta-programs โ€” think testing tools or special-needs access programs โ€” that need to identify windows by name. ๐Ÿซถ

getMaxSize/1

getMaxSize(This) -> {W :: integer(), H :: integer()} when This :: wxWindow().

Returns the maximum size of the window. ๐Ÿ”ฅ

This is a lil signal to the sizer layout mechanism that this is the maximum possible size, and also the upper bound on the window's size that you can actually set with setSize/6.

See: Overview windowsizing

getMinSize/1

getMinSize(This) -> {W :: integer(), H :: integer()} when This :: wxWindow().

Returns the minimum size of the window โ€” the little hint to the sizer layout mechanism about the smallest size this window is willing to be. ๐Ÿ’–

Normally this method just returns whatever you set with setMinSize/2, but it can be overridden so it does the calculation on demand instead. Flexible icon behaviour. ๐Ÿ’…

See: Overview windowsizing

getName/1

getName(This) -> unicode:charlist() when This :: wxWindow().

Returns the window's name. โœจ

Remark: this name is not guaranteed to be unique. It's fully up to the programmer to supply an appropriate name in the window constructor or through setName/2. So no blaming the library when two windows show up to the party in the same outfit. ๐Ÿ™ˆ

See: setName/2

getParent/1

getParent(This) -> wxWindow() when This :: wxWindow().

Returns the parent of the window ๐Ÿซถ or NULL if there is no parent. Every main character needs their origin story.

getPosition/1

getPosition(This) -> {X :: integer(), Y :: integer()} when This :: wxWindow().

Gets the position of the window in pixels โ€” relative to the parent window if it's a child window, or relative to the display origin if it's a top level window. Location reveal, but make it coordinates. ๐ŸŽ€

See: getScreenPosition/1

getRect/1

getRect(This) ->
            {X :: integer(),
             Y :: integer(),
             W :: integer(),
             H :: integer()}
            when This :: wxWindow().

Returns the position and size of the window as a {X,Y,W,H} object. Four numbers, one vibe. โœจ

See: getScreenRect/1

getScreenPosition/1

getScreenPosition(This) -> {X :: integer(), Y :: integer()} when This :: wxWindow().

Returns the window position in screen coordinates, and it does not care whether the window is a child window or a top level one โ€” everybody gets screen coords. ๐ŸŒˆ

See: getPosition/1

getScreenRect/1

getScreenRect(This) ->
                  {X :: integer(),
                   Y :: integer(),
                   W :: integer(),
                   H :: integer()}
                  when This :: wxWindow().

Returns the position and size of the window on the screen as a {X,Y,W,H} object. Same energy as getRect/1 but it's giving global. ๐Ÿ‘‘

See: getRect/1

getScrollPos/2

getScrollPos(This, Orientation) -> integer()
    when This :: wxWindow(), Orientation :: integer().

Returns the built-in scrollbar position. ๐ŸŽ€

See: setScrollbar/6

getScrollRange/2

getScrollRange(This, Orientation) -> integer()
    when This :: wxWindow(), Orientation :: integer().

Returns the built-in scrollbar range. The scrollbar said "this is how far I'm willing to go". ๐Ÿ’…

See: setScrollbar/6

getScrollThumb/2

getScrollThumb(This, Orientation) -> integer()
    when This :: wxWindow(), Orientation :: integer().

Returns the built-in scrollbar thumb size โ€” yeah, the little grabby part has a size and we respect it. ๐Ÿซถ

See: setScrollbar/6

getSize/1

getSize(This) -> {W :: integer(), H :: integer()} when This :: wxWindow().

Okay so for the real deets on this one, go look at the GetSize(int,int) overload. That's where the info lives bestie, not here. ๐Ÿ“Œ

getSizer/1

getSizer(This) -> wxSizer:wxSizer() when This :: wxWindow().

Returns the sizer that got attached to the window by a previous call to setSizer/3 โ€” or NULL if nobody ever set one up. No sizer, no problem. ๐ŸŒธ

getTextExtent/3

getTextExtent(This, String, [Option]) -> Result
              when
                  Result ::
                      {W :: integer(),
                       H :: integer(),
                       Descent :: integer(),
                       ExternalLeading :: integer()},
                  This :: wxWindow(),
                  String :: unicode:chardata(),
                  Option :: {theFont, wxFont:wxFont()}.

Gets the dimensions of the string exactly as it would be drawn on the window with the currently selected font. โœจ

The text extent comes back in the w and h pointers โ€” that's your width and height, and you also get the descent and external leading in the result tuple. Font metrics tea, spilled. ๐Ÿ’…

getThemeEnabled/1

getThemeEnabled(This) -> boolean() when This :: wxWindow().

Returns true if the window uses the system theme for drawing its background. ๐ŸŽ€

See: setThemeEnabled/2

getToolTip/1

getToolTip(This) -> wxToolTip:wxToolTip() when This :: wxWindow().

Get the associated tooltip, or NULL if there is none. That hover text has a whole object behind it, iykyk. ๐Ÿซถ

getUpdateRegion/1

getUpdateRegion(This) -> wxRegion:wxRegion() when This :: wxWindow().

Gets the dimensions of the string as it would be drawn on the window with the currently selected font. ๐Ÿ˜ญ (yes bestie, the docs literally repeat the getTextExtent/3 sentence right here โ€” we don't make the rules, we just report them faithfully ๐Ÿ™ˆ)

The actual deal: it returns the region specifying which parts of the window have been damaged. ๐Ÿฉน

Real talk: this should only be called inside a wxPaintEvent handler. Don't be out here calling it whenever, that's not the vibe check it'll pass.

See: wxRegion

getVirtualSize/1

getVirtualSize(This) -> {W :: integer(), H :: integer()} when This :: wxWindow().

This gets the virtual size of the window in pixels. โœจ

By default it returns the client size of the window, but once you've called setVirtualSize/3 it'll return whatever size you set with that method instead.

See: Overview windowsizing

getWindowStyleFlag/1

getWindowStyleFlag(This) -> integer() when This :: wxWindow().

Gets the window style that was passed to the constructor or to the create/4 method. ๐ŸŽ€

Fun fact: GetWindowStyle() (not implemented in wx) is just another name for this exact same function. Same queen, different alias. ๐Ÿ’…

getWindowVariant/1

getWindowVariant(This) -> wx:wx_enum() when This :: wxWindow().

Returns the value that was previously passed to setWindowVariant/2. Memory: intact. ๐Ÿซถ

hasCapture/1

hasCapture(This) -> boolean() when This :: wxWindow().

Returns true if this window has the current mouse capture. ๐Ÿ–ฑ๏ธ๐Ÿ’–

See:

  • captureMouse/1
  • releaseMouse/1
  • wxMouseCaptureLostEvent
  • wxMouseCaptureChangedEvent

hasScrollbar/2

hasScrollbar(This, Orient) -> boolean()
    when This :: wxWindow(), Orient :: integer().

Returns true if this window currently has a scroll bar for this orientation. โœจ

Here's the nuance bestie, don't skip it: this method may return false even when CanScroll() (not implemented in wx) returns true for the same orientation. But if CanScroll() (not implemented in wx) returns false โ€” meaning scrolling in that direction isn't enabled at all โ€” then hasScrollbar/2 will always return false as well. The logic is strict like that. ๐Ÿ’…

hasTransparentBackground/1

hasTransparentBackground(This) -> boolean() when This :: wxWindow().

Returns true if this window background is transparent (like, for example, for wxStaticText) and should therefore show the parent window background through it. ๐Ÿฆ‹

This method is mostly used internally by the library itself, and normally you shouldn't have to call it. That said, you may have to override it in your wxWindow-derived class to make sure the background gets painted correctly. So it's giving "internal business, until it's your business". ๐Ÿ™ˆ

hide/1

hide(This) -> boolean() when This :: wxWindow().

Equivalent to calling show/2(false). That's it. Window said "and I oop, goodbye". ๐Ÿ‘‹โœจ

inheritAttributes/1

inheritAttributes(This) -> ok when This :: wxWindow().

This function is (or should be, in the case of custom controls) called during window creation to intelligently set up the window's visual attributes โ€” that's the font, plus the foreground and background colours. ๐Ÿ’…

By "intelligently", here's what we mean: by default, all windows use their own GetClassDefaultAttributes() (not implemented in wx) default attributes. However, if some of the parent's attributes were explicitly changed โ€” that is, using setFont/2 and not setOwnFont/2 โ€” and the corresponding attribute hadn't been explicitly set for this window itself, then this window takes the same value used by the parent. And on top of that, if the window overrides shouldInheritColours/1 to return false, the colours won't be changed no matter what, and only the font might get altered. ๐ŸŽ€

This rather complicated logic is necessary in order to accommodate the different usage scenarios. The most common one is when all default attributes are used โ€” and in that case, nothing should be inherited, because in modern GUIs different controls use different fonts (and colours) than their siblings, so they can't inherit the same value from the parent. However, it was also deemed desirable to let you simply change the attributes of all children at once by just changing the font or colour of their common parent โ€” hence, in that case, we do inherit the parent's attributes. Big brain family-resemblance situation. ๐Ÿงš

initDialog/1

initDialog(This) -> ok when This :: wxWindow().

Sends a wxEVT_INIT_DIALOG event, whose handler usually transfers data to the dialog via validators. Ring the doorbell and let the validators do the handing over. ๐Ÿ””โœจ

invalidateBestSize/1

invalidateBestSize(This) -> ok when This :: wxWindow().

Resets the cached best size value so it'll be recalculated the next time it's needed. Out with the old, recalculated with the new. ๐Ÿ’–

See: cacheBestSize/2

isDoubleBuffered/1

isDoubleBuffered(This) -> boolean() when This :: wxWindow().

Returns a boolean about whether the window is double buffered โ€” that's the whole entry, no extra lore attached. ๐ŸŽ€ (and yes, we're still going, there's more coming ๐Ÿ’…)

Returns true if the window contents is double-buffered by the system, i.e. if any drawing done on the window is really done on a temporary backing surface and transferred to the screen all at once later. Translation: you paint into a lil secret surface and the whole thing gets yeeted onto the screen in one go, no flicker, no tears โœจ

  • See: wxBufferedDC

isEnabled

isEnabled(This) -> boolean() when This :: wxWindow().

Returns true if the window is enabled, i.e. if it accepts user input, and false otherwise.

๐Ÿ’€ okay but listen: this can return false even when this window itself was never explicitly disabled โ€” because one of its parent windows is disabled. If you want the intrinsic status of this window, use IsThisEnabled() (not implemented in wx).
  • See: enable/2

isExposed โ€” the Pt / Rect clauses

isExposed(This, Pt) -> boolean()
    when This :: wxWindow(),
         Pt :: {X :: integer(), Y :: integer()};
(This, Rect) -> boolean()
    when This :: wxWindow(),
         Rect :: {X :: integer(), Y :: integer(), W :: integer(), H :: integer()}.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

(that's the whole description bestie, we move ๐Ÿซถ)


isExposed โ€” the X, Y one

isExposed(This, X, Y) -> boolean()
    when This :: wxWindow(),
         X :: integer(),
         Y :: integer().

Returns true if the given point or rectangle area has been exposed since the last repaint.

Call this inside a paint event handler to optimize redrawing โ€” that way you only redraw those areas which have actually been exposed, instead of doing the absolute most every single frame ๐Ÿ’…


isExposed โ€” the X, Y, W, H one

isExposed(This, X, Y, W, H) -> boolean()
    when This :: wxWindow(),
         X :: integer(),
         Y :: integer(),
         W :: integer(),
         H :: integer().

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.


isFrozen

isFrozen(This) -> boolean() when This :: wxWindow().

Returns true if the window is currently frozen by a call to freeze/1. So if you froze it, it's giving popsicle ๐ŸงŠ

  • See:
    • freeze/1
    • thaw/1

isRetained

isRetained(This) -> boolean() when This :: wxWindow().

Returns true if the window is retained, false otherwise.

  • Remark: Retained windows are only available on X platforms.

isShown

isShown(This) -> boolean() when This :: wxWindow().

Returns true if the window is shown, false if it has been hidden.

  • See: isShownOnScreen/1

isShownOnScreen

isShownOnScreen(This) -> boolean() when This :: wxWindow().

Returns true if the window is physically visible on the screen, i.e. it is shown and all its parents up to the toplevel window are shown as well. Not just "shown in theory" โ€” actually on screen, on the glass, visible visible ๐Ÿ‘‘

  • See: isShown/1

isTopLevel

isTopLevel(This) -> boolean() when This :: wxWindow().

Returns true if the given window is a top-level one.

Currently all frames and dialogs are considered to be top-level windows (even if they have a parent window).


layout

layout(This) -> boolean() when This :: wxWindow().

Lays out the children of this window using the associated sizer.

If a sizer hadn't been associated with this window (see setSizer/3), this function doesn't do anything, unless this is a top level window (see layout/1).

Note that this method is called automatically when the window size changes if it has the associated sizer (or if setAutoLayout/2 with true argument had been explicitly called), ensuring that it is always laid out correctly.

  • See: Overview windowsizing
  • Return: Always returns true, the return value is not useful.

lineDown

lineDown(This) -> boolean() when This :: wxWindow().

Same as scrollLines/2 (1).

lineUp

lineUp(This) -> boolean() when This :: wxWindow().

Same as scrollLines/2 (-1).


lower

lower(This) -> ok when This :: wxWindow().

Lowers the window to the bottom of the window hierarchy (Z-order). Down it goes ๐Ÿ“‰

  • Remark: This function only works for wxTopLevelWindow-derived classes.
  • See: raise/1

move โ€” the X, Y / Pt clauses

move(This, X, Y) -> ok
    when This :: wxWindow(), X :: integer(), Y :: integer();
(This, Pt, [Option]) -> ok
    when This :: wxWindow(),
         Pt :: {X :: integer(), Y :: integer()},
         Option :: {flags, integer()}.

Moves the window to the given position.

  • Remark: Implementations of setSize/6 can also implicitly implement the move/4 function, which is defined in the base wxWindow class as the call:
genuinely the sentence just ends there in the doc ๐Ÿ’€ the call itself never gets written out. iconic behaviour. moving on.
  • See: setSize/6

move โ€” the X, Y, [Option] one

move(This, X, Y, [Option]) -> ok
    when This :: wxWindow(),
         X :: integer(),
         Y :: integer(),
         Option :: {flags, integer()}.

Moves the window to the given position.

  • Remark: Implementations of SetSize can also implicitly implement the move/4 function, which is defined in the base wxWindow class as the call:
(and yeah, this one also cuts off mid-thought ๐Ÿ’€ also yes, it says SetSize with a capital S right here โ€” that's exactly how the page has it, not a typo from me.)
  • See: setSize/6

moveAfterInTabOrder

moveAfterInTabOrder(This, Win) -> ok
    when This :: wxWindow(), Win :: wxWindow().

Moves this window in the tab navigation order after the specified win.

This means that when the user presses Tab on that other window, the focus switches to this window.

Default tab order is the same as creation order โ€” this function and moveBeforeInTabOrder/2 let you change it after creating all the windows. Rerouting the tab flow like a lil DJ ๐ŸŽง


moveBeforeInTabOrder

moveBeforeInTabOrder(This, Win) -> ok
    when This :: wxWindow(), Win :: wxWindow().

Same as moveAfterInTabOrder/2 except that it inserts this window just before win instead of putting it right after it.


navigate(This, [Option]) -> boolean()
    when This :: wxWindow(), Option :: {flags, integer()}.

Performs a keyboard navigation action starting from this window.

This method is equivalent to calling NavigateIn() (not implemented in wx) method on the parent window.

  • Return: Returns true if the focus was moved to another window, or false if nothing changed.
  • Remark: You may wish to call this from a text control custom keypress handler to do the default navigation behaviour for the tab key, since the standard default behaviour for a multiline text control with the wxTE_PROCESS_TAB style is to insert a tab and not navigate to the next control. See also wxNavigationKeyEvent and HandleAsNavigationKey.

new

new() -> wxWindow().

Default constructor. Baby's first window ๐ŸŒฑ

new

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

Constructs a window, which can be a child of a frame, dialog or any other non-control window.


pageDown

pageDown(This) -> boolean() when This :: wxWindow().

Same as scrollPages/2 (1).

pageUp

pageUp(This) -> boolean() when This :: wxWindow().

Same as scrollPages/2 (-1).


popupMenu โ€” the Menu, [Option] one

popupMenu(This, Menu, [Option]) -> boolean()
    when This :: wxWindow(),
         Menu :: wxMenu:wxMenu(),
         Option :: {pos, {X :: integer(), Y :: integer()}}.

Pops up the given menu at the specified coordinates, relative to this window, and returns control when the user has dismissed the menu.

If a menu item is selected, the corresponding menu event is generated and will be processed as usual. If coordinates are not specified, the current mouse cursor position is used.

menu is the menu to pop up.

The position where the menu will appear can be specified either as a {X,Y} pos or by two integers (x and y).

Note that this function switches focus to this window before showing the menu.

  • Remark: Just before the menu is popped up, wxMenu::UpdateUI (not implemented in wx) is called to ensure that the menu items are in the correct state. The menu does not get deleted by the window. It is recommended to not explicitly specify coordinates when calling PopupMenu in response to mouse click, because some of the ports (namely, wxGTK) can do a better job of positioning the menu in that case.
  • See: wxMenu

popupMenu โ€” the Menu, X, Y one

popupMenu(This, Menu, X, Y) -> boolean()
    when This :: wxWindow(),
         Menu :: wxMenu:wxMenu(),
         X :: integer(),
         Y :: integer().

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.


raise

raise(This) -> ok when This :: wxWindow().

Raises the window to the top of the window hierarchy (Z-order). Up up and away ๐Ÿ™Œ

Notice that this function only requests the window manager to raise this window to the top of Z-order. Depending on its configuration, the window manager may raise the window, not do it at all, or indicate that a window requested to be raised in some other way, e.g. by flashing its icon if it is minimized. So likeโ€ฆ you asked nicely, bestie, that's all you can do ๐Ÿฅบ

  • Remark: This function only works for wxTopLevelWindow-derived classes.
  • See: lower/1

refresh

refresh(This, [Option]) -> ok
    when This :: wxWindow(),
         Option :: {eraseBackground, boolean()} |
                   {rect, {X :: integer(), Y :: integer(),
                           W :: integer(), H :: integer()}}.

Causes this window, and all of its children recursively (except under wxGTK1 where this is not implemented), to be repainted.

Note that repainting doesn't happen immediately but only during the next event loop iteration โ€” if you need to update the window immediately you should use update/1 instead. Patience, queen โณ

  • See: refreshRect/3

โœจ refreshRect/3 โœจ

refreshRect(This, Rect, [Option]) -> ok
    when
        This :: wxWindow(),
        Rect ::
            {X :: integer(),
             Y :: integer(),
             W :: integer(),
             H :: integer()},
        Option :: {eraseBackground, boolean()}.

Okay so this one redraws the contents of the rectangle you hand it โ€” and only the area inside that rectangle gets repainted, nothing else, very demure, very mindful ๐ŸŽ€

It's literally the same as refresh/2 but with a cuter syntax, because you can just toss a temporary {X,Y,W,H} object at it like this:

RefreshRect(wxRect(x, y, w, h))

slay ๐Ÿ’…


๐ŸŒธ releaseMouse/1 ๐ŸŒธ

releaseMouse(This) -> ok when This :: wxWindow().

Releases mouse input that got captured with captureMouse/1. That's it, that's the whole job, and she does it flawlessly ๐Ÿฆ‹

See:

  • captureMouse/1
  • hasCapture/1
  • releaseMouse/1
  • wxMouseCaptureLostEvent
  • wxMouseCaptureChangedEvent

๐Ÿ’– removeChild/2 ๐Ÿ’–

removeChild(This, Child) -> ok
    when This :: wxWindow(), Child :: wxWindow().

Removes a child window. Basically the "we don't claim you anymore" moment ๐Ÿ˜ญ

This gets called automatically by window deletion functions, so you, an application programmer, should not need it. And here's the thing โ€” this function is mostly internal to wxWidgets and shouldn't be called by user code. Like, it's giving "staff only" vibes. Stay out of the kitchen bestie ๐Ÿ”ฅ


๐ŸŽ€ reparent/2 ๐ŸŽ€

reparent(This, NewParent) -> boolean()
    when This :: wxWindow(), NewParent :: wxWindow().

Reparents the window, i.e. the window gets yanked out of its current parent window (say, a non-standard toolbar in a wxFrame) and then re-inserted into another one. It's giving "moving out and moving back in with a new family" energy ๐Ÿ โœจ

Notice that currently you need to explicitly call wxBookCtrlBase:removePage/2 before reparenting a notebook page. No skipping this step, bestie, it will simply not work. ๐Ÿ™ˆ

๐Ÿ‘‘ screenToClient/1 ๐Ÿ‘‘

screenToClient(This) -> {X :: integer(), Y :: integer()}
    when This :: wxWindow().

Converts from screen to client window coordinates. Coordinates? Translated. Obsessed ๐Ÿ’…


๐Ÿ‘‘ screenToClient/2 ๐Ÿ‘‘

screenToClient(This, Pt) -> {X :: integer(), Y :: integer()}
    when
        This :: wxWindow(),
        Pt :: {X :: integer(), Y :: integer()}.

Converts from screen to client window coordinates. Same energy as the one above, except you bring your own point to the party โœจ


โญ scrollLines/2 โญ

scrollLines(This, Lines) -> boolean()
    when This :: wxWindow(), Lines :: integer().

Scrolls the window by the given number of lines down (if Lines is positive) or up (if it's negative, iykyk).

Return: Returns true if the window was scrolled, false if it was already on top/bottom and nothing was done. Yeah, she'll tell you if she did nothing. Honest queen ๐Ÿซถ

Remark: This function is currently only implemented under MSW and wxTextCtrl under wxGTK (it also works for wxScrolled (not implemented in wx) classes under all platforms).

See: scrollPages/2


โญ scrollPages/2 โญ

scrollPages(This, Pages) -> boolean()
    when This :: wxWindow(), Pages :: integer().

Scrolls the window by the given number of pages down (if Pages is positive) or up.

Return: Returns true if the window was scrolled, false if it was already on top/bottom and nothing was done. Same deal as her sister above ๐Ÿ’€

Remark: This function is currently only implemented under MSW and wxGTK.

See: scrollLines/2


๐Ÿฆ‹ scrollWindow/4 ๐Ÿฆ‹

scrollWindow(This, Dx, Dy, [Option]) -> ok
    when
        This :: wxWindow(),
        Dx :: integer(),
        Dy :: integer(),
        Option ::
            {rect,
             {X :: integer(),
              Y :: integer(),
              W :: integer(),
              H :: integer()}}.

Physically scrolls the pixels in the window and moves child windows accordingly. Physically! The pixels are MOVING. ๐Ÿƒโ€โ™€๏ธ๐Ÿ’จ

Remark: Note that you can often use wxScrolled (not implemented in wx) instead of using this function directly. She's just saying you could. No pressure. ๐ŸŒˆ

๐Ÿ’œ setAcceleratorTable/2 ๐Ÿ’œ

setAcceleratorTable(This, Accel) -> ok
    when
        This :: wxWindow(),
        Accel ::
            wxAcceleratorTable:wxAcceleratorTable().

Sets the accelerator table for this window. Keyboard shortcuts, but make it fancy โœจ

See wxAcceleratorTable.


๐ŸŒŸ setAutoLayout/2 ๐ŸŒŸ

setAutoLayout(This, AutoLayout) -> ok
    when This :: wxWindow(), AutoLayout :: boolean().

Determines whether the layout/1 function will be called automatically when the window is resized. Autopilot mode, but for your layout, no cap ๐ŸŽ€

This method is called implicitly by setSizer/3, but if you use SetConstraints() (not implemented in wx) you should call it manually โ€” otherwise the window layout won't be correctly updated when its size changes. And then everything looks broken and you're sad. Don't be sad. Call it manually. ๐Ÿ˜ญ

See: setSizer/3


๐ŸŒธ setBackgroundColour/2 ๐ŸŒธ

setBackgroundColour(This, Colour) -> boolean()
    when
        This :: wxWindow(),
        Colour :: wx:wx_colour().

Sets the background colour of the window. Aesthetic upgrade, fr fr ๐Ÿ’…

Notice that as with setForegroundColour/2, setting the background colour of a native control may not affect the entire control and could be not supported at all depending on the control and platform. So likeโ€ฆ temper your expectations, bestie ๐Ÿ™ˆ

Please see inheritAttributes/1 for the explanation of the difference between this method and setOwnBackgroundColour/2.

Remark: The background colour is usually painted by the default wxEraseEvent event handler function under Windows and automatically under GTK. Note that setting the background colour does not cause an immediate refresh, so you may wish to call clearBackground/1 or refresh/2 after calling this function. Using this function will disable attempts to use themes for this window, if the system supports them. Use with care since usually the themes represent the appearance chosen by the user to be used for all applications on the system.

Return: true if the colour was really changed, false if it was already set to this colour and nothing was done. She's not redoing work she already did, periodt ๐Ÿ’ฏ

See:

  • getBackgroundColour/1
  • setForegroundColour/2
  • getForegroundColour/1
  • clearBackground/1
  • refresh/2
  • wxEraseEvent
  • wxSystemSettings

๐ŸŒˆ setBackgroundStyle/2 ๐ŸŒˆ

setBackgroundStyle(This, Style) -> boolean()
    when
        This :: wxWindow(),
        Style :: wx:wx_enum().

Sets the background style of the window. Okay this one is a whole personality quiz, so let me explain each option, bestie, because the defaults MATTER here ๐Ÿ”ฅ

The default background style is wxBG_STYLE_ERASE, which indicates that the window background may be erased in the EVT_ERASE_BACKGROUND handler. It's a safe, compatibility default โ€” she's the reliable friend who shows up on time, no drama ๐Ÿซถ

However, you may want to change it to wxBG_STYLE_SYSTEM if you don't define any erase background event handlers at all, to avoid unnecessary generation of erase background events and always let the system erase the background. Less work, less events, iconic behavior โœจ

And you should change the background style to wxBG_STYLE_PAINT if you define an EVT_PAINT handler which completely overwrites the window background โ€” because in that case, erasing it previously, either in the EVT_ERASE_BACKGROUND handler or in the system default handler, would result in flicker as the background pixels will be repainted twice every time the window is redrawn. Flicker is giving 2009, we don't want that ๐Ÿ’€

Do ensure that the background is entirely erased by your EVT_PAINT handler in this case however, as otherwise garbage may be left on screen. Garbage on screen?? Absolutely not, bestie, we are not doing that ๐Ÿ™ˆ
Notice that in previous versions of wxWidgets, a common way to work around the above mentioned flickering problem was to define an empty EVT_ERASE_BACKGROUND handler. Setting the background style to wxBG_STYLE_PAINT is a simpler and more efficient solution to the same problem. Glow-up achieved ๐Ÿ’…

Under wxGTK and wxOSX, you can use ?wxBG_STYLE_TRANSPARENT to obtain full transparency of the window background. Note that wxGTK supports this only since GTK 2.12 with a compositing manager enabled โ€” call IsTransparentBackgroundSupported() (not implemented in wx) to check whether this is the case. Always check, bestie, don't just assume ๐Ÿงš

Also, in order for SetBackgroundStyle(wxBG_STYLE_TRANSPARENT) to work, it must be called before create/4. If you're using your own wxWindow-derived class you should write your code in the following way:

okay so the original page says "in the following way" and thenโ€ฆ the code sample that should be here just isn't in the text. Not in the source I'm working from, anyway โ€” so I'm flagging it instead of inventing one for you. No fake code on my watch. ๐Ÿ“

See:

  • setBackgroundColour/2
  • getForegroundColour/1
  • setTransparent/2

๐Ÿ’– setCaret/2 ๐Ÿ’–

setCaret(This, Caret) -> ok
    when This :: wxWindow(), Caret :: wxCaret:wxCaret().

Sets the caret() associated with the window. The blinking little cursor gets a home ๐ŸŽ€โœจ


๐Ÿซถ setClientSize/2 ๐Ÿซถ

setClientSize(This, Size) -> ok
    when
        This :: wxWindow(),
        Size :: {W :: integer(), H :: integer()};
(This, Rect) -> ok
    when
        This :: wxWindow(),
        Rect ::
            {X :: integer(),
             Y :: integer(),
             W :: integer(),
             H :: integer()}.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Overloaded queen, she contains multitudes ๐Ÿ’…


๐Ÿซถ setClientSize/3 ๐Ÿซถ

setClientSize(This, Width, Height) -> ok
    when
        This :: wxWindow(),
        Width :: integer(),
        Height :: integer().

This sets the size of the window client area in pixels.

Using this function to size a window tends to be more device-independent than setSize/6, since the application need not worry about what dimensions the border or title bar have when trying to fit the window around panel items, for example. Like, you don't have to do border math?? iconic, obsessed, no notes ๐Ÿ‘‘

See: Overview windowsizing


๐Ÿงš setContainingSizer/2 ๐Ÿงš

setContainingSizer(This, Sizer) -> ok
    when
        This :: wxWindow(),
        Sizer :: wxSizer:wxSizer().

Used by wxSizer internally to notify the window about being managed by the given sizer. It's an internal announcement, like a group chat notification nobody else can see ๐ŸŒธ

This method should not be called from outside the library, unless you're implementing a custom sizer class โ€” and in the latter case you must call this method with the pointer to the sizer itself whenever a window is added to it, and with a NULL argument when the window is removed from it. So: added โ†’ pass the sizer. Removed โ†’ pass NULL. Do not mix those up or it's chaos ๐Ÿ’€๐Ÿ™ˆ


setCursor(This, Cursor) -> boolean()

setCursor(This, Cursor) -> boolean()
    when
        This :: wxWindow(),
        Cursor :: wxCursor:wxCursor().

Sets the window's cursor, bestie. โœจ

Heads up tho โ€” the window cursor also sets it for the children of the window, implicitly. So it's giving generational trauma but for cursors, fr fr.

The cursor may be wxNullCursor, in which case the window cursor gets reset back to default. Slay, clean slate. ๐Ÿ’…

See:

  • wx_misc:setCursor/1
  • wxCursor

setDoubleBuffered(This, On) -> ok

setDoubleBuffered(This, On) -> ok
    when
        This :: wxWindow(), On :: boolean().

Turns double buffering of the window on or off โ€” but only if the system supports it. Not every system is invited to this party, and that's just how it is. ๐Ÿซถ


setDropTarget(This, Target) -> ok

setDropTarget(This, Target) -> ok
    when
        This :: wxWindow(), Target :: wx:wx_object().

Associates a drop target with this window. Drag-and-drop arc incoming. ๐Ÿฆ‹

If the window already has a drop target, it is deleted. Gone. Replaced. No cap.

See:

  • getDropTarget/1
  • Overview dnd

setExtraStyle(This, ExStyle) -> ok

setExtraStyle(This, ExStyle) -> ok
    when
        This :: wxWindow(), ExStyle :: integer().

Sets the extra style bits for the window. The currently defined extra style bits are reported in the class description โ€” go check there, iykyk. ๐Ÿ‘‘


setFocus(This) -> ok

setFocus(This) -> ok
    when
        This :: wxWindow().

This sets the window to receive keyboard input. Main character energy: now all the typing goes to this window. ๐Ÿ˜ค

See:

  • wxFocusEvent
  • setFocus/1
  • wxPanel:setFocusIgnoringChildren/1

setFocusFromKbd(This) -> ok

setFocusFromKbd(This) -> ok
    when
        This :: wxWindow().

This function is called by wxWidgets keyboard navigation code when the user gives the focus to this window from the keyboard (e.g. hitting the TAB key, iconic behaviour honestly).

By default this method simply calls setFocus/1 โ€” but it can be overridden to do something in addition to that in the derived classes. Custom vibes only. โœจ


setFont(This, Font) -> boolean()

setFont(This, Font) -> boolean()
    when
        This :: wxWindow(), Font :: wxFont:wxFont().

Sets the font for this window. ๐ŸŽ€

Real talk tho: this function should not be called for the parent window if you don't want its font to be inherited by its children. Use setOwnFont/2 instead in that case, and see inheritAttributes/1 for more explanations. Inheritance is not always the serve you think it is, bestie.

Also please notice that the given font is not automatically used for wxPaintDC objects associated with this window โ€” you need to call wxDC:setFont/2 too. However, this font is used by any standard controls for drawing their text as well as by getTextExtent/3.

Return: true if the font was really changed, false if it was already set to this font and nothing was done. Lowkey the most honest return value ever. ๐Ÿ’€

See:

  • getFont/1
  • inheritAttributes/1

setForegroundColour(This, Colour) -> boolean()

setForegroundColour(This, Colour) -> boolean()
    when
        This :: wxWindow(),
        Colour :: wx:wx_colour().

Sets the foreground colour of the window. ๐Ÿ’…

The meaning of foreground colour varies according to the window class โ€” it may be the text colour or some other colour, or it may not be used at all. Additionally, not all native controls support changing their foreground colour, so this method may change their colour only partially or even not at all. It's giving "we tried". ๐Ÿ˜ญ

Please see inheritAttributes/1 for an explanation of the difference between this method and setOwnForegroundColour/2.

Return: true if the colour was really changed, false if it was already set to this colour and nothing was done.

See:

  • getForegroundColour/1
  • setBackgroundColour/2
  • getBackgroundColour/1
  • shouldInheritColours/1

setHelpText(This, HelpText) -> ok

setHelpText(This, HelpText) -> ok
    when
        This :: wxWindow(),
        HelpText :: unicode:chardata().

Sets the help text to be used as context-sensitive help for this window. ๐Ÿงš

Note that the text is actually stored by the current wxHelpProvider (not implemented in wx) implementation, and not in the window object itself. Sneaky lil storage situation, fr fr.

See: getHelpText/1


setId(This, Winid) -> ok

setId(This, Winid) -> ok
    when
        This :: wxWindow(), Winid :: integer().

Sets the identifier of the window. ๐Ÿชช

Remark: Each window has an integer identifier. If the application has not provided one, an identifier will be generated. Normally, the identifier should be provided on creation and should not be modified subsequently โ€” pick a name and commit to it, periodt.

See:

  • getId/1
  • Overview windowids

setLabel(This, Label) -> ok

setLabel(This, Label) -> ok
    when
        This :: wxWindow(), Label :: unicode:chardata().

Sets the window's label. Glow-up for the text, basically. โœจ

See: getLabel/1


setMaxSize(This, Size) -> ok

setMaxSize(This, Size) -> ok
    when
        This :: wxWindow(),
        Size :: {W :: integer(), H :: integer()}.

Sets the maximum size of the window, to indicate to the sizer layout mechanism that this is the maximum possible size. Setting boundaries, we love to see it. ๐Ÿซถ

See: Overview windowsizing


setMinSize(This, Size) -> ok

setMinSize(This, Size) -> ok
    when
        This :: wxWindow(),
        Size :: {W :: integer(), H :: integer()}.

Sets the minimum size of the window, to indicate to the sizer layout mechanism that this is the minimum required size.

You may need to call this if you change the window size after construction and before adding it to its parent sizer.

Notice that calling this method doesn't prevent the program from making the window explicitly smaller than the specified size by calling setSize/6 โ€” it just ensures that it won't become smaller than this size during the automatic layout. So it's a minimum for the vibes, not a hard wall, iykyk. ๐Ÿ’…

See: Overview windowsizing


setName(This, Name) -> ok

setName(This, Name) -> ok
    when
        This :: wxWindow(), Name :: unicode:chardata().

Sets the window's name. ๐ŸŽ€

See: getName/1


setOwnBackgroundColour(This, Colour) -> ok

setOwnBackgroundColour(This, Colour) -> ok
    when
        This :: wxWindow(),
        Colour :: wx:wx_colour().

Sets the background colour of the window but prevents it from being inherited by the children of this window. Keeping your aesthetic to yourself, as you should. ๐Ÿ’…

See:

  • setBackgroundColour/2
  • inheritAttributes/1

setOwnFont(This, Font) -> ok

setOwnFont(This, Font) -> ok
    when
        This :: wxWindow(), Font :: wxFont:wxFont().

Sets the font of the window but prevents it from being inherited by the children of this window. ๐Ÿฆ‹

See:

  • setFont/2
  • inheritAttributes/1

setOwnForegroundColour(This, Colour) -> ok

setOwnForegroundColour(This, Colour) -> ok
    when
        This :: wxWindow(),
        Colour :: wx:wx_colour().

Sets the foreground colour of the window but prevents it from being inherited by the children of this window. Boundaries!! Healthy!! ๐ŸŒธ

See:

  • setForegroundColour/2
  • inheritAttributes/1

setPalette(This, Pal) -> ok

setPalette(This, Pal) -> ok
    when
        This :: wxWindow(), Pal :: wxPalette:wxPalette().

Deprecated: use wxDC:setPalette/2 instead. It's over, babe, use the other one. ๐Ÿ’€


setScrollPos(This, Orientation, Pos, [Option]) -> ok

setScrollPos(This, Orientation, Pos, [Option]) -> ok
    when
        This :: wxWindow(),
        Orientation :: integer(),
        Pos :: integer(),
        Option :: {refresh, boolean()}.

Sets the position of one of the built-in scrollbars.

Remark: This function does not directly affect the contents of the window โ€” it is up to the application to take note of scrollbar attributes and redraw contents accordingly. You do the redrawing, bestie, this function is just the messenger. ๐Ÿ˜ญ

See:

  • setScrollbar/6
  • getScrollPos/2
  • getScrollThumb/2
  • wxScrollBar

setScrollbar(This, Orientation, Position, ThumbSize, Range, [Option]) -> ok

setScrollbar(This, Orientation, Position, ThumbSize, Range, [Option]) -> ok
    when
        This :: wxWindow(),
        Orientation :: integer(),
        Position :: integer(),
        ThumbSize :: integer(),
        Range :: integer(),
        Option :: {refresh, boolean()}.

Sets the scrollbar properties of a built-in scrollbar.

Remark: Let's say you wish to display 50 lines of text, using the same font. The window is sized so that you can only see 16 lines at a time. You would use:

Note that with the window at this size, the thumb position can never go above 50 minus 16, or 34. You can determine how many lines are currently visible by dividing the current view size by the character height in pixels. When defining your own scrollbar behaviour, you will always need to recalculate the scrollbar settings when the window size changes. You could therefore put your scrollbar calculations and SetScrollbar call into a function named AdjustScrollbars, which can be called initially and also from your wxSizeEvent handler function. Math girlies rise up. ๐Ÿ“โœจ

See:

  • Overview scrolling
  • wxScrollBar
  • wxScrollWinEvent

setSize(This, Rect) -> ok

setSize(This, Rect) -> ok
    when
        This :: wxWindow(),
        Rect ::
            {X :: integer(),
             Y :: integer(),
             W :: integer(),
             H :: integer()};
        (This, Size) -> ok
    when
        This :: wxWindow(),
        Size :: {W :: integer(), H :: integer()}.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Same energy, different args, periodt. ๐Ÿ’…


setSize(This, Width, Height) -> ok

setSize(This, Width, Height) -> ok
    when
        This :: wxWindow(),
        Width :: integer(),
        Height :: integer();
        (This, Rect, [Option]) -> ok
    when
        This :: wxWindow(),
        Rect ::
            {X :: integer(),
             Y :: integer(),
             W :: integer(),
             H :: integer()},
        Option :: {sizeFlags, integer()}.
More overloaded setSize goodness, still coming at you โ€” the arguments switch up but the name stays the same. Classic. ๐Ÿ™ˆ

Sets the size of the window in pixels, bestie, and the way you tell it that size is via a {X,Y,W,H}, or a {Width,Height}, or honestly just a couple of plain int objects. Whatever's easiest for you. ๐Ÿ’…

Remark: this form must be used with non-default width and height values. Non-negotiable, sorry. ๐Ÿ™ˆ

See:

  • move/4
  • Overview windowsizing

๐ŸŽ€ setSize (the position + optionally size one)

setSize(This, X, Y, Width, Height, [Option]) -> ok
                when
                    This :: wxWindow(),
                    X :: integer(),
                    Y :: integer(),
                    Width :: integer(),
                    Height :: integer(),
                    Option :: {sizeFlags, integer()}.

Sets the size of the window in pixels. Iconic behaviour tbh. โœจ

Remark: this overload sets the position and optionally size, of the window. Parameters may be wxDefaultCoord to indicate either that a default should be supplied by wxWidgets, or that the current value of the dimension should be used. So like, wxDefaultCoord = "you decide, king", or = "keep whatever you've got, queen". Both vibes are valid. ๐Ÿ‘‘

See:

  • move/4
  • Overview windowsizing

โœจ setSizeHints

setSizeHints(This, MinW, MinH) -> ok
                      when
                          This :: wxWindow(),
                          MinW :: integer(),
                          MinH :: integer();
                  (This, MinSize, [Option]) -> ok
                      when
                          This :: wxWindow(),
                          MinSize :: {W :: integer(), H :: integer()},
                          Option ::
                              {maxSize,
                               {W :: integer(), H :: integer()}} |
                              {incSize,
                               {W :: integer(), H :: integer()}}.

Okay so using this function for windows that are not toplevel windows (like wxDialog or wxFrame) is discouraged. Notably not the vibe. ๐Ÿซฃ

Please use setMinSize/2 and setMaxSize/2 instead. Periodt. ๐Ÿ’–

See:

  • setSizeHints/4
  • Overview windowsizing

๐Ÿฆ‹ setSizeHints/4 โ€” the overload

setSizeHints(This, MinW, MinH, [Option]) -> ok
                      when
                          This :: wxWindow(),
                          MinW :: integer(),
                          MinH :: integer(),
                          Option ::
                              {maxW, integer()} |
                              {maxH, integer()} |
                              {incW, integer()} |
                              {incH, integer()}.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Same energy, different arg list, iykyk. ๐Ÿ’ซ


๐Ÿ’œ setSizer

setSizer(This, Sizer, [Option]) -> ok
                      when
                          This :: wxWindow(),
                          Sizer :: wxSizer:wxSizer(),
                          Option :: {deleteOld, boolean()}.

Sets the window to have the given layout sizer. At that point the window owns the object, and it'll take care of its deletion for you โ€” no takebacks, no cleanup on your end. ๐Ÿซถ

If an existing layout constraints object is already owned by the window, it will be deleted if the deleteOld parameter is true.

Note that this function will also call setAutoLayout/2 implicitly with true parameter if the sizer is non-NULL and false otherwise, so that the sizer will be effectively used to layout the window children whenever it is resized. It's giving "I handled it already". ๐Ÿ˜Œ

Remark: SetSizer enables and disables Layout automatically. Main character energy fr fr. ๐Ÿ‘‘

๐ŸŒธ setSizerAndFit

setSizerAndFit(This, Sizer, [Option]) -> ok
                            when
                                This :: wxWindow(),
                                Sizer :: wxSizer:wxSizer(),
                                Option :: {deleteOld, boolean()}.

Associate the sizer with the window and set the window size and minimal size accordingly. The two-in-one combo meal. ๐Ÿ“

This method calls setSizer/3 and then wxSizer:setSizeHints/2, which:

  • sets the initial window size to the size needed to accommodate all sizer elements, and
  • sets the minimal size to the same size,

...which prevents the user from resizing this window to be less than this minimal size (if it's a top-level window which can be directly resized by the user). Protection mode: activated. ๐Ÿ›ก๏ธโœจ


๐ŸŒˆ setThemeEnabled

setThemeEnabled(This, Enable) -> ok
                         when This :: wxWindow(), Enable :: boolean().

This function tells a window if it should use the system's "theme" code to draw the windows' background instead of its own background drawing code. Letting the OS cook instead of you. ๐Ÿณ

This does not always have any effect since the underlying platform obviously needs to support the notion of themes in user defined windows. One such platform is GTK+, where windows can have (very colourful) backgrounds defined by a user's selected theme. ๐Ÿ’

Dialogs, notebook pages and the status bar have this flag set to true by default so that the default look and feel is simulated best. They woke up flawless. ๐Ÿ’…

See: getThemeEnabled/1


๐Ÿงš setToolTip

setToolTip(This, TipString) -> ok
                    when
                        This :: wxWindow(),
                        TipString :: unicode:chardata();
                (This, Tip) -> ok
                    when
                        This :: wxWindow(), Tip ::
wxToolTip:wxToolTip().

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Two ways in, one tiny tooltip out. ๐ŸŽ€


โญ setTransparent

setTransparent(This, Alpha) -> boolean()
                        when This :: wxWindow(), Alpha :: integer().

Set the transparency of the window. Ghost mode. ๐Ÿ‘ป

If the system supports transparent windows, returns true, otherwise returns false and the window remains fully opaque. See also canSetTransparent/1.

The parameter alpha is in the range 0..255 where 0 corresponds to a fully transparent window and 255 to the fully opaque one. The constants wxIMAGE_ALPHA_TRANSPARENT and wxIMAGE_ALPHA_OPAQUE can be used. Sliding scale, no cap. ๐Ÿฆ‹


๐Ÿซง setVirtualSize/2 โ€” the overload

setVirtualSize(This, Size) -> ok
                        when
                            This :: wxWindow(),
                            Size :: {W :: integer(), H :: integer()}.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Same thing, tuple edition. โœจ

๐Ÿซง setVirtualSize/3

setVirtualSize(This, Width, Height) -> ok
                        when
                            This :: wxWindow(),
                            Width :: integer(),
                            Height :: integer().

Sets the virtual size of the window in pixels. That's the whole assignment bestie.

See: Overview windowsizing


๐Ÿ’ซ setWindowStyle

setWindowStyle(This, Style) -> ok
                        when This :: wxWindow(), Style :: integer().

See setWindowStyleFlag/2 for more info. That's it, that's the note. Emotional support cross-reference. ๐Ÿซถ


๐Ÿ‘‘ setWindowStyleFlag

setWindowStyleFlag(This, Style) -> ok
                            when This :: wxWindow(), Style :: integer().

Sets the style of the window. Glow up for your window, lowkey. โœจ

Please note that some styles cannot be changed after the window creation, and that refresh/2 might need to be called after changing the others for the change to take place immediately. Some things are permanent, some things just need a little refresh. ๐Ÿ˜Œ

See Window styles for more information about flags.

See: getWindowStyleFlag/1


๐Ÿฆ„ setWindowVariant

setWindowVariant(This, Variant) -> ok
                          when
                              This :: wxWindow(),
                              Variant :: wx:wx_enum().

Chooses a different variant of the window display to use. Choose your fighter. ๐ŸŽฎ

Window variants currently just differ in size, as can be seen from ?wxWindowVariant documentation. Under all platforms but macOS, this function does nothing more than change the font used by the window. However under macOS it is implemented natively and selects the appropriate variant of the native widget, which has better appearance than just scaled down or up version of the normal variant, so it should be preferred to directly tweaking the font size. Mac stays winning, we don't make the rules. ๐ŸŽ

By default the controls naturally use the normal variant. No notes. ๐Ÿ’…


๐ŸŒท shouldInheritColours

shouldInheritColours(This) -> boolean() when This :: wxWindow().

Return true from here to allow the colours of this window to be changed by inheritAttributes/1. Yes bestie, share the palette. ๐ŸŽจ

Returning false forbids inheriting them from the parent window. Boundaries! ๐Ÿšง

The base class version returns false, but this method is overridden in wxControl where it returns true. Overachiever behaviour honestly. ๐Ÿ’–


๐Ÿ”ฅ show

show(This, [Option]) -> boolean()
              when This :: wxWindow(), Option :: {show, boolean()}.

Shows or hides the window. The classic peekaboo. ๐Ÿ™ˆ

You may need to call raise/1 for a top level window if you want to bring it to top, although this is not needed if show/2 is called immediately after the frame creation. Timing is everything, bestie. โฐ

Notice that the default state of newly created top level windows is hidden (to allow you to create their contents without flicker), unlike for all the other, not derived from wxTopLevelWindow, windows that are by default created in the shown state. Shy toplevels, loud-and-proud everything else. ๐Ÿ˜ญ

Return: true if the window has been shown or hidden, or false if nothing was done because it already was in the requested state. No change, no credit. ๐Ÿ’€

See:

  • isShown/1
  • hide/1
  • wxRadioBox:show/3
  • wxShowEvent

๐ŸงŠ thaw

thaw(This) -> ok when This :: wxWindow().

Re-enables window updating after a previous call to freeze/1. Un-pause the vibe. โ–ถ๏ธ

To really thaw the control, it must be called exactly the same number of times as freeze/1. Keep count, bestie, this one's strict. ๐Ÿ”ข

If the window has any children, they are recursively thawed too. The whole family thaws together. ๐Ÿซ‚

See:

  • freeze/1
  • isFrozen/1

๐Ÿ“ toDIP

toDIP(D, W) -> integer() when D :: integer(), W :: wxWindow();
           (Sz, W) -> {W :: integer(), H :: integer()}
               when
                   Sz :: {W :: integer(), H :: integer()},
                   W :: wxWindow();
           (This, D) -> integer()
               when This :: wxWindow(), D :: integer();
           (This, Sz) -> {W :: integer(), H :: integer()}
               when
                   This :: wxWindow(),
                   Sz :: {W :: integer(), H :: integer()}.

Convert pixel values of the current toolkit to DPI-independent pixel values. Four flavours, same delicious conversion. ๐ŸŒˆโœจ

okay so a DPI-independent pixel is literally just a pixel at the standard 96 DPI resolution, that's it, that's the whole thing ๐Ÿ’…

To keep the same physical size at higher resolution, the physical pixel value has to be scaled by getDPIScaleFactor/1 โ€” but the underlying toolkit (GTK+, Cocoa, ...) may have already done that scaling automatically for you. This method performs the conversion only if it is not already done by the lower level toolkit. For example, you may want to use this to store window sizes and positions so that they can be re-used regardless of the display DPI:

๐Ÿซถ Also note that if either component of sz has the special value of -1, it is returned unchanged independently of the current DPI, to preserve the special value of -1 in wxWidgets API (it is often used to mean "unspecified").

Since: 3.1.0


๐Ÿฆ‹ transferDataFromWindow(This) -> boolean() when This :: wxWindow().

Transfers values from child controls over to the data areas specified by their validators. ๐Ÿ’ซ

Returns false if a transfer failed.

Notice that this also calls transferDataFromWindow/1 for all children recursively โ€” it's giving "and tell your friends too" energy, fr fr.

See:

  • transferDataToWindow/1
  • validate/1

๐ŸŽ€ transferDataToWindow(This) -> boolean() when This :: wxWindow().

Transfers values from the data areas specified by their validators into the child controls. The reverse glow-up of the one above, bestie โœจ

Notice that this also calls transferDataToWindow/1 for all children recursively.

Return: Returns false if a transfer failed.

See:

  • transferDataFromWindow/1
  • validate/1

๐Ÿ’– update(This) -> ok when This :: wxWindow().

Calling this method immediately repaints the invalidated area of the window and all of its children recursively (this normally only happens when the flow of control returns to the event loop).

โš ๏ธ Notice that this function doesn't invalidate any area of the window, so nothing happens if nothing has been invalidated (i.e. marked as requiring a redraw). Use refresh/2 first if you want to immediately redraw the window unconditionally.

๐ŸŒˆ updateWindowUI(This, [Option]) -> ok

when
    This :: wxWindow(),
    Option :: {flags, integer()}.

This function sends one or more wxUpdateUIEvent to the window. ๐Ÿ“ฌ

The particular implementation depends on the window; for example a wxToolBar will send an update UI event for each toolbar button, and a wxFrame will send an update UI event for each menubar menu item.

You can call this function from your application to ensure that your UI is up-to-date at this point (as far as your wxUpdateUIEvent handlers are concerned). This may be necessary if you have called wxUpdateUIEvent:setMode/1 or wxUpdateUIEvent:setUpdateInterval/1 to limit the overhead that wxWidgets incurs by sending update UI events in idle time. flags should be a bitlist of one or more of the ?wxUpdateUI enumeration. ๐Ÿ‘‘

๐Ÿงš If you are calling this function from an OnInternalIdle or OnIdle function, make sure you pass the wxUPDATE_UI_FROMIDLE flag, since this tells the window to only update the UI elements that need to be updated in idle time. Some windows update their elements only when necessary, for example when a menu is about to be shown. The following is an example of how to call UpdateWindowUI from an idle function.

See: wxUpdateUIEvent


๐ŸŒธ validate(This) -> boolean() when This :: wxWindow().

Validates the current values of the child controls using their validators. Yep, vibe check but for your form fields ๐Ÿ’…

Notice that this also calls validate/1 for all children recursively.

Return: Returns false if any of the validations failed.

See:

  • transferDataFromWindow/1
  • transferDataToWindow/1

โญ warpPointer(This, X, Y) -> ok

when
    This :: wxWindow(),
    X :: integer(),
    Y :: integer().

Moves the pointer to the given position on the window. Teleporting the cursor, iconic honestly ๐Ÿช„

๐Ÿ’€ Note: Apple Human Interface Guidelines forbid moving the mouse cursor programmatically so you should avoid using this function in Mac applications (and probably avoid using it under the other platforms without good reason as well).

aaaand that's a wrap on the whole page, bestie ๐ŸŽ‰ you made it, I'm so proud. this whole thing is brought to you by Ericsson AB, running version wx 2.6, and it's the wxWindow(3) manual page โ€” go forth and window responsibly, mwah ๐Ÿซถ๐Ÿ’œ

๐Ÿ“ฆ where this page comes from