Elgrint::MScreen class
Declared in MScreen.h
Description
The system's topmost window, which serves as a container for MMainFrame windows.

Base class: MWindow
Properties:
Name | Description |
---|---|
StatusIcon | Specifies the screen's status icon, associated with this app. |
Revealers:
Name | Description |
---|---|
getWindowAt(p) | Returns the front-most window, which contains the specified point (in screen coordinates). |
getWorkRect() | Returns the working area of the screen. |
Handlers:
Name | Description |
---|---|
OnKeysEntered | Passes the keys to the system or to the focus window. Details: All the keys between kbPrintScreen and kbUnknown are passed to the system for default system processing. For example, kbCalculator key may launch the "calc.exe" program, kbMyComputer may open the file browser, and so on. Remarks:
|
Details
The screen window is a special, predefined window object - a sole instance of this MScreen class. The sole screen object is accessed via MApp::screen function, and no other screen object can be created (MScreen has no public constructors). Needless to say, MPtr, which requires a public standard-form constructor, does not work with this class.
The screen window has two purposes: it serves as the root of the app's window hierarchy, and it represents the external environment, e.g. the screen and other apps (in particular, it receives remote messages from other apps).
'MScreen' class defines a few methods of its own, but also changes the meaning of some of the MWindow methods, as follows:
- CursorImage property overrides the cursor image setting for all other windows. As long as the screen's cursor is anything but ZeroImage, all app windows will display the screen's cursor, regardless of their own settings. This can be useful for displaying the piWait cursor during some lengthy operation
- The screen cannot be resized or moved by the app (setRect, setSize, setPos, sendBackward, and bringForward generate exception 2001). However, if the screen's resolution/orientation or even the screen's work rect (see getWorkRect) are changed by the system, the screen window object does receive a Resized message (but never a Moved message)
- The screen cannot be disabled - disable generates exception 2001 if used on the screen window. The enable can be used, but it has no effect because the screen is always enabled anyway
- The screen can be a parent of MMainFrame windows only. Specifying the screen as a parent for any other type of window generates exception 2001
- The screen does not receive Paint messages, even though repaint does work on the screen (refreshes it)
- requestPropagation generates exception 4001 to remind that this operation is practically meaningless for the screen window, which does not allow overloading message handlers
- The painting functions are clipped only by the screen's edges, not by windows. In other words, screen's painting functions draw on the entire screen over all the windows, even those belonging to other programs
- getImage returns a true screenshot (or a portion of it), not the result of a Paint message as in every other window class
- The screen is the only possible origin (as returned by digOrigin) for the external messages (see Messages)
On the other hand, in the following cases the screen window behaves in accordance with other windows, but it is still worth mentioning that:
- The screen is the ancestor of all windows except for itself (see isAncestorOf)
- Therefore, close terminates the entire app (unconditionally), because all windows are closed automatically if their ancestor is closed
- getParent returns the screen itself (i.e. the screen is its own parent)
- getSize returns the screen's resolution in pixels (effectively, the size of the screen)
- getPos always returns (0,0,0). The screen's z coordinate is always 0, because it can be neither in front of itself nor behind itself (see getRect). No other window has z=0
- The screen is focused/hot iff no other app window is focused/hot (the actual focused/hot window can be in another app or even non-existent)
- Message handlers cannot be overridden, because MScreen cannot serve as a base class (has no public constructors)
- The initial value of the RTL property is inherited from the system rather than from the parent, because the screen does not have a distinct parent
In all other respects the screen window is just a regular Elgrint window.
Let us know
Please Contact us to report any errors on this page, or to suggest any improvements.