window<%> : interface? | ||
|
enabled —
default is #t; passed to enable if #f
(send a-window accept-drop-files) → boolean? (send a-window accept-drop-files accept-files?) → void? accept-files? : any/c
(send a-window client->screen x y) →
(integer-in -10000 10000) (integer-in -10000 10000) x : (integer-in -10000 10000) y : (integer-in -10000 10000)
On Mac OS X, the screen coordinates start with (0, 0) at the upper left of the menu bar. In contrast, move in top-level-window<%> considers (0, 0) to be below the menu bar. See also get-display-left-top-inset.
The enable state of a window can be changed by enabling a parent window, and such changes do not go through this method; use on-superwindow-enable to monitor enable state changes.
If enable? is true, the window is enabled, otherwise it is disabled.
See also on-focus.
Note that on Unix, keyboard focus can move to the menu bar when the user is selecting a menu item.
The current keyboard focus window can be changed by the user, and such changes do not go through this method; use on-focus to monitor focus changes.
(send a-window get-client-handle) → cpointer?
Windows: HWND
Mac OS X: NSView
Unix: GtkWidget
See also get-handle.
(send a-window get-client-size)
→
(integer-in 0 10000) (integer-in 0 10000)
The client size is returned as two values: width and height (in pixels).
See also reflow-container.
(send a-window get-cursor) → (or/c (is-a?/c cursor%) #f)
(send a-window get-handle) → cpointer?
Windows: HWND
Mac OS X: NSWindow for a top-level-window<%> object, NSView for other windows
Unix: GtkWidget
See also get-client-handle.
(send a-window get-height) → (integer-in 0 10000)
See also reflow-container.
(send a-window get-label)
→
(or/c label-string? (is-a?/c bitmap%) (one-of/c 'app 'caution 'stop) (list/c (is-a?/c bitmap%) label-string? (one-of/c 'left 'top 'right 'bottom)) #f)
A label string may contain &s, which serve as keyboard navigation annotations for controls on Windows and Unix. The ampersands are not part of the displayed label of a control; instead, ampersands are removed in the displayed label (on all platforms), and any character preceding an ampersand is underlined (Windows and Unix) indicating that the character is a mnemonic for the control. Double ampersands are converted into a single ampersand (with no displayed underline). See also on-traverse-char.
If the window does not have a label, #f is returned.
(send a-window get-plain-label) → (or/c string? #f)
(send a-window get-size)
→
(integer-in 0 10000) (integer-in 0 10000)
The geometry is returned as two values: width and height (in pixels).
See also reflow-container.
(send a-window get-width) → (integer-in 0 10000)
See also reflow-container.
(send a-window get-x) → (integer-in -10000 10000)
See also reflow-container.
(send a-window get-y) → (integer-in -10000 10000)
See also reflow-container.
(send a-window has-focus?) → boolean?
(send a-window is-enabled?) → boolean?
(send a-window on-drop-file pathname) → void? pathname : path?
On Mac OS X, when the application is running and user double-clicks an application-handled file or drags a file onto the application’s icon, the main thread’s application file handler is called (see application-file-handler). The default handler calls the on-drop-file method of the most-recently activated frame if drag-and-drop is enabled for that frame, independent of the frame’s eventspace (but the method is called in the frame’s eventspace’s handler thread). When the application is not running, the filenames are provided as command-line arguments.
Note that on Unix, keyboard focus can move to the menu bar when the user is selecting a menu item.
Default implementation: Does nothing.
(send a-window on-move x y) → void? x : (integer-in -10000 10000) y : (integer-in -10000 10000)
Default implementation: Does nothing.
(send a-window on-size width height) → void? width : (integer-in 0 10000) height : (integer-in 0 10000)
Default implementation: Does nothing.
(send a-window on-subwindow-char receiver event) → boolean? receiver : (is-a?/c window<%>) event : (is-a?/c key-event%)
The event argument is the event that was generated for the receiver window.
The atomicity limitation on-subwindow-event applies to on-subwindow-char as well. That is, an insufficiently cooperative on-subwindow-char method can effectively disable a control’s handling of key events, even when it returns #f
BEWARE: The default on-subwindow-char in frame% and on-subwindow-char in dialog% methods consume certain keyboard events (e.g., arrow keys, Enter) used for navigating within the window. Because the top-level window gets the first chance to handle the keyboard event, some events never reach the “receiver” child unless the default frame or dialog method is overridden.
Default implementation: Returns #f.
(send a-window on-subwindow-event receiver event) → boolean? receiver : (is-a?/c window<%>) event : (is-a?/c mouse-event%)
The event argument is the event that was generated for the receiver window.
If the on-subwindow-event method chain does not complete atomically (i.e., without requiring other threads to run) or does not complete fast enough, then the corresponding event may not be delivered to a target control, such as a button. In other words, an insufficiently cooperative on-subwindow-event method can effectively disable a control’s handling of mouse events, even when it returns #f.
Default implementation: Returns #f.
(send a-window on-subwindow-focus receiver on?) → void? receiver : (is-a?/c window<%>) on? : boolean?
Default implementation: Does nothing.
(send a-window on-superwindow-enable enabled?) → void? enabled? : any/c
This method is not called when the window is initially created; it is called only after a change from the window’s initial enable state. Furthermore, if an enable notification event is queued for the window and it reverts its enabled state before the event is dispatched, then the dispatch is canceled.
If the enable state of a window’s ancestor changes while the window is deleted (e.g., because it was removed with delete-child), then no enable events are queued for the deleted window. But if the window is later re-activated into an enable state that is different from the window’s state when it was de-activated, then an enable event is immediately queued.
Default implementation: Does nothing.
(send a-window on-superwindow-show shown?) → void? shown? : any/c
This method is not called when the window is initially created; it is called only after a change from the window’s initial visibility. Furthermore, if a show notification event is queued for the window and it reverts its visibility before the event is dispatched, then the dispatch is canceled.
Default implementation: Does nothing.
(send a-window popup-menu menu x y) → void? menu : (is-a?/c popup-menu%) x : (integer-in 0 10000) y : (integer-in 0 10000)
The menu is popped up within the window at position (x, y).
(send a-window screen->client x y) →
(integer-in -10000 10000) (integer-in -10000 10000) x : (integer-in -10000 10000) y : (integer-in -10000 10000)
If a window does not have a cursor, it uses the cursor of its parent. Frames and dialogs start with the standard arrow cursor, and text fields start with an I-beam cursor. All other windows are created without a cursor.
(send a-window set-label l) → void? l : label-string?
If the window was not created with a label, or if the window was created with a non-string label, l is ignored.
See get-label for more information.
The visibility of a window can be changed by the user clicking the window’s close box, for example, and such changes do not go through this method; use on-superwindow-show or on-close to monitor visibility changes.
If show? is #f, the window is hidden. Otherwise, the window is shown.