2.1.18 frame%

► |  | GUI: Racket Graphics Toolkit

1 | Overview
2 | Reference
3 | Configuration
4 | Dynamic Loading
| Bibliography
| Index

► | 2 | Reference

2.1 | Windowing Classes
2.2 | Windowing Functions
2.3 | Drawing Classes
2.4 | Drawing Functions
2.5 | Editor Classes
2.6 | Editor Functions
2.7 | WXME Decoding

▼ | 2.1 | Windowing Classes

2.1.1 | area<%>
2.1.2 | area-container<%>
2.1.3 | area-container-window<%>
2.1.4 | button%
2.1.5 | canvas<%>
2.1.6 | canvas%
2.1.7 | check-box%
2.1.8 | checkable-menu-item%
2.1.9 | choice%
2.1.10 | clipboard-client%
2.1.11 | clipboard<%>
2.1.12 | combo-field%
2.1.13 | control<%>
2.1.14 | control-event%
2.1.15 | cursor%
2.1.16 | dialog%
2.1.17 | event%
2.1.18 | frame%
2.1.19 | gauge%
2.1.20 | group-box-panel%
2.1.21 | grow-box-spacer-pane%
2.1.22 | horizontal-pane%
2.1.23 | horizontal-panel%
2.1.24 | key-event%
2.1.25 | labelled-menu-item<%>
2.1.26 | list-box%
2.1.27 | list-control<%>
2.1.28 | menu%
2.1.29 | menu-bar%
2.1.30 | menu-item<%>
2.1.31 | menu-item%
2.1.32 | menu-item-container<%>
2.1.33 | message%
2.1.34 | mouse-event%
2.1.35 | pane%
2.1.36 | panel%
2.1.37 | popup-menu%
2.1.38 | radio-box%
2.1.39 | selectable-menu-item<%>
2.1.40 | separator-menu-item%
2.1.41 | scroll-event%
2.1.42 | slider%
2.1.43 | subarea<%>
2.1.44 | subwindow<%>
2.1.45 | tab-panel%
2.1.46 | text-field%
2.1.47 | timer%
2.1.48 | top-level-window<%>
2.1.49 | vertical-pane%
2.1.50 | vertical-panel%
2.1.51 | window<%>

On this page:

create-status-line
get-menu-bar
has-status-line?
iconize
is-iconized?
is-maximized?
maximize
modified
on-mdi-activate
on-menu-char
on-subwindow-char
on-toolbar-button-click
set-icon
set-status-text

Inherited methods:
from top-level-window<%>
can-close?
can-exit?
center
get-edit-target-object
get-edit-target-window
get-eventspace
get-focus-object
get-focus-window
move
on-activate
on-close
on-exit
on-message
on-system-menu-char
on-traverse-char
resize
show
from window<%>
accept-drop-files
client->screen
enable
focus
get-client-size
get-cursor
get-handle
get-height
get-label
get-plain-label
get-size
get-width
get-x
get-y
has-focus?
is-enabled?
is-shown?
on-drop-file
on-focus
on-move
on-size
on-subwindow-event
on-superwindow-enable
on-superwindow-show
popup-menu
refresh
screen->client
set-cursor
set-label
from area<%>
get-graphical-min-size
get-parent
get-top-level-window
min-height
min-width
stretchable-height
stretchable-width
from area-container<%>
add-child
after-new-child
begin-container-sequence
border
change-children
container-flow-modified
container-size
delete-child
end-container-sequence
get-alignment
get-children
place-children
reflow-container
set-alignment
spacing

top← prev up next →

frame% : class?
superclass: object%

extends: | top-level-window<%>

A frame is a top-level container window. It has a title bar (which displays the frame’s label), an optional menu bar, and an optional status line.

Under Windows, both Multiple Document Interface (MDI) and Single Document Interface (SDI) frames are supported.

( new frame% |  | [label label] |
| [ | [parent parent] |
|  | [width width] |
|  | [height height] |
|  | [x x] |
|  | [y y] |
|  | [style style] |
|  | [enabled enabled] |
|  | [border border] |
|  | [spacing spacing] |
|  | [alignment alignment] |
|  | [min-width min-width] |
|  | [min-height min-height] |
|  | [stretchable-width stretchable-width] |
|  | [stretchable-height stretchable-height]]) |

→ ( is-a?/c frame%)
label : label-string?
parent : ( or/c ( is-a?/c frame%) false/c) = #f
width : ( or/c ( integer-in 0 10000) false/c) = #f
height : ( or/c ( integer-in 0 10000) false/c) = #f
x : ( or/c ( integer-in -10000 10000) false/c) = #f
y : ( or/c ( integer-in -10000 10000) false/c) = #f

style

:

( listof ( one-of/c 'no-resize-border 'no-caption
'no-system-menu 'hide-menu-bar
'mdi-parent 'mdi-child
'toolbar-button 'float 'metal))

|  |  | = |  | null

enabled : any/c = #t
border : ( integer-in 0 1000) = 0
spacing : ( integer-in 0 1000) = 0

alignment

:

( list/c ( one-of/c 'left 'center 'right)
( one-of/c 'top 'center 'bottom))

|  |  | = |  | '(center top)

min-width : ( integer-in 0 10000) = graphical-minimum-width
min-height : ( integer-in 0 10000) = graphical-minimum-height
stretchable-width : any/c = #t
stretchable-height : any/c = #t

The label string is displayed in the frame’s title bar. If the frame’s label is changed (see set-label), the title bar is updated.

The parent argument can be #f or an existing frame. Under Windows, if parent is an existing frame, the new frame is always on top of its parent. Also, the parent frame may be an MDI parent frame from a new MDI child frame. Under Windows and X (for many window managers), a frame is iconized when its parent is iconized.

If parent is #f, then the eventspace for the new frame is the current eventspace, as determined by current-eventspace. Otherwise, parent’s eventspace is the new frame’s eventspace.

If the width or height argument is not #f, it specifies an initial size for the frame (in pixels) assuming that it is larger than the minimum size, otherwise the minimum size is used.

If the x or y argument is not #f, it specifies an initial location for the frame. Otherwise, a location is selected automatically (tiling frames and dialogs as they are created).

The style flags adjust the appearance of the frame on some platforms:

- 'no-resize-border – omits the resizeable border around the window (Windows, X MWM) or grow box in the bottom right corner (Mac OS X)

- 'no-caption – omits the title bar for the frame (Windows, X MWM)

  (X Gnome, X KDE: the frame decoration is omitted completely when 'no-resize-border and 'no-caption are combined.)

- 'no-system-menu – omits the system menu (Windows)

- 'mdi-child – creates the frame as a MDI (multiple document interface) child frame, mutually exclusive with 'mdi-parent (Windows)

- 'mdi-parent – creates the frame as a MDI (multiple document interface) parent frame, mutually exclusive with 'mdi-child (Windows)

- 'toolbar-button – includes a toolbar button on the frame’s title bar (Mac OS X); a click on the toolbar button triggers a call to on-toolbar-button-click

- 'hide-menu-bar – hides the menu bar and dock when the frame is active (Mac OS X)

- 'float – causes the frame to stay in front of all other non-floating windows (Windows and Mac OS X always, X when combined with 'no-caption); under Mac OS X, a floating frame shares the focus with an active non-floating frame; when this style is combined with 'no-caption, then showing the frame does not cause the keyboard focus to shift to the window, and under X, clicking the frame does not move the focus; under Windows, a floating frame has no taskbar button

- 'metal – draws the frame with a brushed-metal background (Mac OS X); this style is ignored when 'no-caption is specified

If the 'mdi-child style is specified, the parent must be a frame with the 'mdi-parent style, otherwise an exn:fail:contract exception is raised.

Even if the frame is not shown, a few notification events may be queued for the frame on creation. Consequently, the new frame’s resources (e.g., memory) cannot be reclaimed until some events are handled, or the frame’s eventspace is shut down.

For information about the enabled argument, see window<%>. For information about the border, spacing, and alignment arguments, see area-container<%>. For information about the min-width, min-height, stretchable-width, and stretchable-height arguments, see area<%>.

( send a-frame create-status-line) → void?

Creates a status line at the bottom of the frame. The width of the status line is the whole width of the frame (adjusted automatically when resizing), and the height and text size are platform-specific.

See also set-status-text.

( send a-frame get-menu-bar)
→ ( or/c ( is-a?/c menu-bar%) false/c)

Returns the frame’s menu bar, or #f if none has been created for the frame.

( send a-frame has-status-line?) → boolean?

Returns #t if the frame’s status line has been created, #f otherwise. See also create-status-line.

( send a-frame iconize iconize?) → void?
iconize? : any/c

Iconizes (minimizes) or deiconizes (restores) the frame. Deiconizing brings the frame to the front.

A frame’s iconization can be changed by the user, and such changes do not go through this method. A program cannot detect when a frame has been iconized except by polling is-iconized?.

( send a-frame is-iconized?) → boolean?

Returns #t if the frame is iconized (minimized), #f otherwise.

( send a-frame is-maximized?) → boolean?

Under Windows and Mac OS X, returns #t if the frame is maximized, #f otherwise. Under X, the result is always #f.

( send a-frame maximize maximize?) → void?
maximize? : any/c

Specification: Maximizes or restores the frame under Windows and Mac OS X; the frame’s show state is not affected. Under Windows, an iconized frame cannot be maximized or restored.

A window’s maximization can be changed by the user, and such changes do not go through this method; use on-size to monitor size changes.

Default implementation: If maximize? is #f, the window is restored, otherwise it is maximized.

( send a-frame modified) → boolean?
( send a-frame modified modified?) → void?
modified? : any/c

Gets or sets the frame’s modification state as reflected to the user. Under Mac OS X, the modification state is reflected as a dot in the frame’s close button. Under Windows and X, the modification state is reflected by an asterisk at the end of the frame’s displayed title.

( send a-frame on-mdi-activate active?) → void?
active? : any/c

Called under Windows when a MDI-child frame becomes the active frame within its parent (in which case the argument is #t), or when the child frame ceases to be the active frame (in which case the argument is #f).

MDI activation is different from keyboard-focus activation. If the parent frame is the frontmost top-level frame, so that the MDI child gets or loses the keyboard focus, then a separate on-activate notification is sent to the MDI-child frame.

( send a-frame on-menu-char event) → boolean?
event : ( is-a?/c key-event%)

If the frame has a menu bar with keyboard shortcuts, and if the key event includes a Control, Alt, Option, Meta, Command, Shift, or Function key, then on-menu-char attempts to match the given event to a menu item. If a match is found, #t is returned, otherwise #f is returned.

When the match corresponds to a complete shortcut combination, the menu item’s callback is called (before on-menu-char returns).

If the event does not correspond to a complete shortcut combination, the event may be handled anyway if it corresponds to a mnemonic in the menu bar (i.e., an underlined letter in a menu’s title, which is installed by including an ampersand in the menu’s label). If a mnemonic match is found, the keyboard focus is moved to the menu bar (selecting the menu with the mnemonic), and #t is returned.

( send a-frame on-subwindow-char |  | receiver |  |  |  |
|  | event) |  | → |  | boolean?

receiver : ( is-a?/c window<%>)
event : ( is-a?/c key-event%)

Overrides on-subwindow-char in window<%>.
Returns the result of

( or ( send this on-menu-char event)
( send this on-system-menu-char event)
( send this on-traverse-char event))

( send a-frame on-toolbar-button-click) → void?

Under Mac OS X, called when the user clicks the toolbar button on a frame created with the 'toolbar-button style.

( send a-frame set-icon icon [mask which]) → void?
icon : ( is-a?/c bitmap%)
mask : ( is-a?/c bitmap%) = #f
which : ( one-of/c 'small 'large 'both) = 'both

Sets the large or small icon bitmap for this frame. Future changes to the bitmap do not affect the frame’s icon.

The icon is used in a platform-specific way:

- Windows – the small icon is used for the frame’s icon (in the top-left) and in the task bar, and the large icon is used for the Alt-Tab task switcher.

- Mac OS X – both icons are ignored.

- X – many window managers use the small icon in the same way as Windows, and others use the small icon when iconifying the frame; the large icon is ignored.

The bitmap for either icon can be any size, but most platforms scale the small bitmap to 16 by 16 pixels and the large bitmap to 32 by 32 pixels.

If a mask bitmap is not provided, then the entire (rectangular) bitmap is used as an icon.

If a mask bitmap is provided, the mask must be monochrome. In the mask bitmap, use black pixels to indicate the icon’s region and use white pixels outside the icon’s region. In the icon bitmap, use black pixels for the region outside the icon.

( send a-frame set-status-text text) → void?
text : string

Sets the frame’s status line text and redraws the status line. See also create-status-line.
top← prev up next →