A frame is a window whose size and position can (usually) be changed by the user.
It usually has thick borders and a title bar, and can optionally contain a menu bar, toolbar and status bar. A frame can contain any window that is not a frame or dialog.
A frame that has a status bar and toolbar, created via the createStatusBar/2 and createToolBar/2 functions, manages these windows and adjusts the value returned by wxWindow:getClientSize/1 to reflect the remaining size available to application windows.
Remark: An application should normally define an wxCloseEvent handler for the frame to respond to system close events, for example so that related data and subwindows can be cleaned up.
Default event processing
wxFrame processes the following events:
This class supports the following styles:
See also the overview_windowstyles.
This class supports the following extra styles:
wxWidgets docs: wxFrame
new() -> wxFrame()
new(Parent, Id, Title) -> wxFrame()
new(Parent, Id, Title, Options :: [Option]) -> wxFrame()
Constructor, creating the window.
Remark: For Motif, MWM (the Motif Window Manager) should be running for any window styles to work (otherwise all styles take effect).
destroy(This :: wxFrame()) -> ok
Destroys all child windows and menu bar if present.
See overview_windowdeletion for more info.
create(This, Parent, Id, Title) -> boolean()
create(This, Parent, Id, Title, Options :: [Option]) -> boolean()
Used in two-step frame construction.
See new/4 for further details.
createStatusBar(This) -> wxStatusBar:wxStatusBar()
createStatusBar(This, Options :: [Option]) ->
Creates a status bar at the bottom of the frame.
Return: A pointer to the status bar if it was created successfully, NULL otherwise.
Remark: The width of the status bar is the whole width of the frame (adjusted automatically when resizing), and the height and text size are chosen by the host windowing system.
createToolBar(This) -> wxToolBar:wxToolBar()
createToolBar(This, Options :: [Option]) -> wxToolBar:wxToolBar()
Creates a toolbar at the top or left of the frame.
Return: A pointer to the toolbar if it was created successfully, NULL otherwise.
Remark: By default, the toolbar is an instance of wxToolBar. To use a different class, override OnCreateToolBar() (not implemented in wx). When a toolbar has been created with this function, or made known to the frame with setToolBar/2, the frame will manage the toolbar position and adjust the return value from wxWindow:getClientSize/1 to reflect the available space for application windows. Under Pocket PC, you should always use this function for creating the toolbar to be managed by the frame, so that wxWidgets can use a combined menubar and toolbar. Where you manage your own toolbars, create a wxToolBar as usual.
Returns the origin of the frame client area (in client coordinates).
It may be different from (0, 0) if the frame has a toolbar.
getMenuBar(This) -> wxMenuBar:wxMenuBar()
getStatusBar(This) -> wxStatusBar:wxStatusBar()
getStatusBarPane(This) -> integer()
Returns the status bar pane used to display menu and toolbar help.
getToolBar(This) -> wxToolBar:wxToolBar()
processCommand(This, Id) -> boolean()
Simulate a menu command.
sendSizeEvent(This) -> ok
sendSizeEvent(This, Options :: [Option]) -> ok
This function sends a dummy wxSizeEvent to the window allowing it to re-layout its children positions.
It is sometimes useful to call this function after adding or deleting a children after the frame creation or if a child size changes. Note that if the frame is using either sizers or constraints for the children layout, it is enough to call wxWindow:layout/1 directly and this function should not be used in this case.
If flags includes wxSEND_EVENT_POST value, this function posts the event, i.e. schedules it for later processing, instead of dispatching it directly. You can also use PostSizeEvent() (not implemented in wx) as a more readable equivalent of calling this function with this flag.
setMenuBar(This, MenuBar) -> ok
Tells the frame to show the given menu bar.
Remark: If the frame is destroyed, the menu bar and its menus will be destroyed also, so do not delete the menu bar explicitly (except by resetting the frame's menu bar to another frame or NULL). Under Windows, a size event is generated, so be sure to initialize data members properly before calling setMenuBar/2. Note that on some platforms, it is not possible to call this function twice for the same frame object.
setStatusBar(This, StatusBar) -> ok
setStatusBarPane(This, N) -> ok
Set the status bar pane used to display menu and toolbar help.
Using -1 disables help display.
setStatusText(This, Text) -> ok
setStatusText(This, Text, Options :: [Option]) -> ok
setStatusWidths(This, Widths_field) -> ok
Sets the widths of the fields in the status bar.
Remark: The widths of the variable fields are calculated from the total width of all fields, minus the sum of widths of the non-variable fields, divided by the number of variable fields.
setToolBar(This, ToolBar) -> ok
Associates a toolbar with the frame.