Contents Up Previous Next

Frame

A frame is a window containing text, canvas or panel subwindows. It normally has decorations added by the window manager, such as a system menu, a thick frame, and resize handles. When a wxWindows or wxCLIPS application initializes, a top-level frame must be returned to the system for successful start-up. When a top-level frame and all its children are deleted, the application terminates.

Usually an application will need to register an OnClose handler in case the window manager sends the application a close message. If the handler returns 1, the frame is deleted by the system (possibly terminating the application).

The user can register the following callbacks:

OnActivate
Called with a frame identifier and integer flag, when the frame is activated. Under Windows, you may need to intercept this event and set the focus for a subwindow, or the subwindow may not receive character events. By default, wxWindows will set the focus for the first subwindow of a frame.
OnCharHook
Under Windows only, all key strokes going to a dialog box or frame can be intercepted before being passed on for normal processing. This callback function takes the window id and event id, and should return 1 to override further processing, or 0 to do default processing. See also Key event.
OnClose
The function is called with the window identifier. If the callback returns 1 and the function was called by the window manager, the window is automatically deleted (possibly terminating the application). A return value of 0 forbids automatic deletion.
OnMenuCommand
Called with a frame identifier and menu item identifier. Test the menu item identifier and perform an appropriate action.
OnMenuSelect
Called with a frame identifier and menu item identifier, when the cursor travels over the menu item (but the user does not click). Test the menu item identifier and perform an appropriate action.
OnSize
The function is called with the window identifier, width and height.

See also window-add-callback.

frame-create
frame-create-status-line
frame-iconize
frame-is-iconized
frame-on-size
frame-set-menu-bar
frame-set-tool-bar
frame-set-icon
frame-set-status-text
frame-set-title


frame-create

long ( frame-create long parent-id string title
optional long x optional long y
optional long width optional long height optional string style optional string name)

Creates a frame. parent-id can be zero or a valid frame ID; title should be a string for the frame's title.

The style parameter may be a combination of the following, using the bitwise 'or' operator.

wxICONIZE Display the frame iconized (minimized) (Windows only).
wxCAPTION Puts a caption on the frame (under XView and Motif this is mandatory).
wxDEFAULT_FRAME Defined as a combination of wxMINIMIZE_BOX, wxMAXIMIZE_BOX, wxTHICK_FRAME, wxSYSTEM_MENU, and wxCAPTION.
wxMDI_CHILD Specifies a Windows MDI (multiple document interface) child frame.
wxMDI_PARENT Specifies a Windows MDI (multiple document interface) parent frame.
wxMINIMIZE Identical to wxICONIZE.
wxMINIMIZE_BOX Displays a minimize box on the frame (Windows only).
wxMAXIMIZE Displays the frame maximized (Windows only).
wxMAXIMIZE_BOX Displays a maximize box on the frame (Windows only).
wxSDI Specifies a normal SDI (single document interface) frame.
wxSTAY_ON_TOP Stay on top of other windows (Windows only).
wxSYSTEM_MENU Displays a system menu (manadatory under XView and Motif).
wxTHICK_FRAME Displays a thick frame around the window (manadatory under XView and Motif).

name gives the frame a name that can be retrieved with window-get-name.

The function window-show must be called before a new frame is visible.


frame-create-status-line

long ( frame-create-status-line long parent-id, optional long n=1)

Creates a status line at the bottom of the frame. Use frame-set-status-text to write to the status line.

n is a number from 1 to 5 for the number of status areas to create.


frame-iconize

long ( frame-iconize long frame-id optional long minimize)

Minimize the frame if the second argument is 1 or absent, restore the frame otherwise.


frame-is-iconized

long ( frame-is-iconized long frame-id)

Returns 1 if the frame is iconized (minimized), 0 otherwise.


frame-on-size

long ( frame-on-size long frame-id long width long height)

Performs default processing for the OnSize event. Can be called from within an OnSize callback.


frame-set-menu-bar

long ( frame-set-menu-bar long frame-id long menu-bar-id)

Associate a menu bar with the frame. See menu bar.


frame-set-tool-bar

long ( frame-set-tool-bar long frame-id long tool-bar)

Informs an MDI parent window that a panel or canvas should be treated as a toolbar, and sized accordingly. Windows only.


frame-set-icon

long ( frame-set-icon long frame-id long icon-id)

Set the icon of a frame. See icon.


frame-set-status-text

long ( frame-set-status-text long frame-id string text, optional long i=0)

Sets the text for the status line (previously created with frame-create-status-line).

i is a number from 0 to 4 for the number of the status area to write to.


frame-set-title

long ( frame-set-title long frame-id string text)

Set the title of a frame.