Provides a platform-independent widgetset class and helper functions.

interfacebase.pp contains classes, types, and routines used to define a platform-independent widgetset class (TWidgetSet) and helper functions.

This file is part of the Lazarus Component Library (LCL).

Pointer to an event handler routine.

PEventHandler is an alias to the Pointer type. It is used in widgetset class to add or remove event handlers in the class instance.

Pointer to a process event handler routine.

PProcessEventHandler is an alias to the Pointer type. It is used in widgetset class to add or remove process event handlers in the class instance.

Pointer to a pipe event handler routine.

PPipeEventHandler is an alias to the Pointer type. It is used in widgetset class to add or remove pipe event handlers in the class instance.

Pointer to a socket event handler routine.

PSocketEventHandler is an alias to the Pointer type. It is used in widgetset class to add or socket event handlers in the class instance.

Represents reasons that a child process was exited.

TChildExitReason is an enumerated type with values that represent reasons a child process was exited. TChildExitReason values are passed as a parameter to TChildExitEvent event handler routines, and used in the TAsyncProcess.HandleProcessTermination method which implements the event handler.

TAsyncProcess.HandleProcessTermination
Child process was exited normally. Child process was terminated by a signal. Represents reasons that a pipe event was signalled.

TPipeReason is an enumerated type with values that represent reasons a pipe event was signalled. TPipeReason values are passed as a parameter to TPipeEvent event handler routines used in WidgetSet classes.

Data is available as input for the pipe. The pipe was closed or did not provide expected data. Data is available to be written as output. Set type used to store values from TPipeReason. Represents the main processing loop in an application.

TApplicationMainLoop is an object procedure type which represents the main processing loop for an application. TApplicationMainLoop is the type passed as an argument to the TWidgetSet.AppRun method.

Specifies an event handler signalled for the handle in an interface object.

TWaitHandleEvent is an object procedure which specifies an event handler signalled for the handle in an interface object. The parameters contain a pointer to the data and flag values used in the event notification. It provides a callback routine executed when the signal occurs on the handle.

TWaitHandleEvent is passed as an argument to the TWidgetSet.AddEventHandler method.

Integer pointer to the data for the event. Flag value(s) for the event notification. Specifies an event handler signalled when a child process is exited.

TChildExitEvent is an object precedure type which specifies an event handler signalled when a child process is exited in a widgetset object. The parameters provide a pointer to the event data, the reason the process was exited, and a unique identifier for the event.

TChildExitEvent is the type passed as an argument to the TWidgetSet.AddProcessEventHandler method.

Pointer to the data for the event. Reason the process was exited. Unique identifier for the event notification. Specifies an event handler signalled for a pipe handle in a widgetset object.

TPipeEvent is an object procedure type which specifies an event handler signalled for a pipe handle in a widgetset object. It is used for asynchronous process event notifications. The parameters contain a pointer to the data for the event, and the reason for the event notification.

TPipeEvent is the type passed as an argument to the TWidgetSet.AddPipeEventHandler method.

TAsyncProcess
Pointer to the data for the event notification. Reason for the event notification. Specifies an event handler signalled for a socket handle in a widgetset object.

TSocketEvent is an object procedure type which specifies an event handler signalled for a socket handle in a widgetset object.

Cannot find a use case. Redeclared in widgetset classes.
Pointer to the data for the event notification. Flag values for the event notification. The type used for all LCL message handlers. Represents capabilities used in the LCL. TLCLCapability is an enumerated type with values that represent capabilities used in the Lazarus Component Library (LCL). The enumeration values identify features or behaviors that may be implemented in a given widgetset object. The enumeration values can be passed to the TWidgetSet.GetLCLCapability method to determine whether the feature or behavior is implemented for the platform. Supports asynchronous processes. Supports drawing outside of the OnPaint event for a control. When the main form is minimized, the application is minimized too. Can change application title at run-time. Application has a special root window. Forms have an icon. Has native modal window support. Can drag-dock forms by clicking on the title bar. amDontCare is the same as amOn for the widgetset. Has support for the LM_HELP command. Carbon does not receive LM_CLEAR, LM_CUT, LM_COPY, LM_PASTE reliably; this affects DB controls. The interface sends UTF8KeyPress directly. When not available, it will be emulated in TWinControl.CNChar. Used by the LCL custom-drawn widgetset so that it can inject child controls in native ones. Provides emulation of MDI commands for widgetsets which do not provide native MDI handling. Indicates accessibility is implemented; mostly for TCustomControl descendents as native widgetsets should have in-built accessibility. Indicates that CreateBrushWithRadialGradient is supported to create a brush with a radial gradient pattern. Has the ability to pass mouse messages through a window (on win32 LM_NCHITTEST with HTTRANSPARENT result). Has native TextHint support. Task dialogs on MS Windows for widgetsets different than win32/wince. Used in LCLTaskDialog. Qt/Qt5 must set this option to False otherwise taskdialog segfaults. The system rendering engine might request a hidden control to be drawn (macOS 10.9 and later). Supports UI accelerator keys using & as a prefix for the accelerator character. Implements a standard dialog button.

TDialogButton is a TCollectionItem descendant which implements a standard dialog button.

TDialogButton is the type created and stored in the TDialogButtons Collection. An overridden method is provided to use the Caption as the DisplayName for the collection item.

TDialogButton contains properties used to control how a dialog button button is displayed and used.

Caption contains the text displayed on the button face, and can define an accelerator key by prefixing a character with an Ampersand (&).

Cancels indicate if the dialog button is used as the Cancel button in the Collection.

Default indicates if the dialog button is the default button in the Collection.

TCollectionItem.Collection TCollectionItem.DisplayName
Gets the value for the DisplayName property.

GetDisplayName is an overridden method in TDialogButton and uses the value in the Caption property as the name displayed for the collection item.

TCollectionItem.DisplayName
Display name for the collection item. Sets the value for the Caption property. New value for the properly. Constructor for the class instance.

Create is the overridden constructor for the class instance, and calls the inherited method on entry.

ACollection is the TCollection instance which owns the new dialog button. It is assigned to the Collection property in the colleciton item.

Create sets the default values for the Caption and ModalResult properties.

Collection which owns the collection item. Value displayed on the button face.

Caption is a String property with the value displayed on the button face for the dialog button. The value in Caption is also used as the DisplayName for the collection item in the TDialogButtons collection.

TCollectionItem.DisplayName
True if the button is the Cancel button.

Cancel is a Boolean property which indicates if the button is used as the Cancel button in the dialog.

Cancel is True when the button instance is the value assigned to the CancelButton property in TDialogButtons collection. Setting a new value in Cancel causes the CancelButton property in TDialogButtons to be updated accordingly.

Use Default to control whether the button is the default button for the dialog.

Use ModalResult to set the value returned when the button is clicked.

True if the button is the default button.

Default is a Boolean property which indicates if the button is the default button for the dialog.

Default is True when the button instance is the value assigned to the DefaultButton property in the TDialogButtons Collection. Setting a new value in Default causes the DefaultButton property in TDialogButtons to be updated accordingly.

Use Cancel to control whether the button is used as the Cancel button in the dialog.

Use ModalResult to set the value returned when the button is clicked.

The modal result value returned when the button is clicked.

ModalResult is a LongInt property which contains the modal result value returned when the button is clicked in the dialog.

ModalResult values correspond to the values in the TModalResult enumeration, but use the native data type expected in TWidgetSet methods.

TModalResult
Collection used to store TDialogButton instances.

TDialogButtons is a TCollection descendant used to create and maintain the TDialogButton instances in the Items for the collection.

TDialogButtons re-implements methods like GetItem, SetItem, and Add to use the TDialogButton class type when adding or accessing the Items in the collection.

The FindButton method can be used to find a dialog button in the collection which has specific modal result value(s).

Use the DefaultButton and CancelButton properties to access the button instances used for the corresponding purpose in the collection.

TDialogButtons is the type passed as a parameter to the TWidgetSet.AskUser method.

TCollection
Gets the value for the indexed Items property. Value for the indexed property. Ordinal position for the collection item in the property. Sets the value for the CancelButton property. New value for the property. Sets the value for the DefaultButton property. New value for the property. Sets the value in the indexed Items property. Ordinal position for the new value in the Items property. New value stored in the indexed Items property. Adds a new button instance to the Items in the collection.

Add is an overridden TDialogButton function in TDialogButtons used to add a new button instance to the Items in the collection. Add ensures that the value returned from the inherited Add method is cast to the TDialogButton type used in Items.

TCollection.Add
TDialogButton instance created and stored in the Items for the collection. Finds the button associated with (one of) the given modal result values.

FindButton is an overloaded TDialogButton function used to locate a dialog button in the collection which uses the specified modal result value. Overloaded variants are provided which accept one or multiple modal result values to locate in the method.

AModalResult contains the modal result value to locate in the collection Items.

AOrder allows an array of modal resuilt values to be located in the method. It specifies the search order for the modal result values.

FindButton iterates over the Items in the collection to find the first button which uses the modal result value(s). The return value is the first TDialogButton instance in Items which matches the requested value(s).

Dialog button which uses the modal result value. The modal result value for the button located in the method. List of modal result values to find in the collection. The default button for the dialog.

DefaultButton is a TDialogButton property which contains the dialog button which has its Default property set to True.

The property value is assigned when the Default property for a TDialogButton instance in the collection is changed. When Default (in the button) is changed to True, it is stored in DefaultButton. When Default (in the button) is set to False, the value in DefaultButton is set to Nil. It is assumed that a another button will be designated as the default button.

Use CancelButton for the button with its Cancel property set to True.

The cancel button for the dialog. Provides indexed access to the dialog buttons in the collection.

Items is an indexed TDialogButton property used to access to a dialog button by its ordinal position in the Items for the collection. Read and write access to the property value is re-implemented in TDialogButtons to use the TDialogButton type for the collection item in the property value.

Use Count to get the number of dialog buttons stored in Items.

Use Add to create and store a new TDialogButtoon instance in Items.

Use Delete to remove a collection item at a specific position in Items.

Use Clear to remove all Items in the collection.

TCollection.Clear TCollection.Count TCollection.Delete
Ordinal position for the dialog button. Type used for a timer callback procedure. Provides an application helper class (platform and drawing interface).

TWidgetSet is a TObject descendant which implements an application helper class that provides access to platform-specific operating system and drawing interfaces. A number of methods are declared as abstract virtual, and must be implemented in descendent classes. Other methods are declared as virtual to allow them to be overridden for a specific platform.

TWidgetSet is used as the ancestor for platform-specific implementations like TWin32WidgetSet, TGTKWidgetSet, TQtWidgetSet, TCarbonWidgetSet, TCocoaWidgetSet, et. al.

The WidgetSet variable provides access to the TWidgetSet singleton for the current widgetset implementation.

Passes commandline arguments needed for the platform.

PassCmdLineOptions is a procedure used to pass commandline arguments used for the platform-specific widgetset implementation. PassCmdLineOptions has an empty implementation in TWidgetSet, and must be overridden in a descendent class. It allows commandline arguments to be preprocessed or modified prior to starting an application.

Constructor for the class instance.

Create is the constructor for the class instance, and calls the inherited method on entry. Create calls CreateThemeServices to allocate the TThemeServices instance used in the ThemeServices property.

TThemeServices
Performs actions needed before freeing the class instance.

BeforeDestruction is an overridden method used to perform actions needed prior to freeing the class instance. BeforeDestruction ensures that resources allocated for the ThemeServices property are freed and nil'd. BeforeDestruction calls the inherited method prior to exit.

TObject
Initializes the application for the platform, and returns Screen information.

Called by Application.Initialize. Don't call this directly, the LCL will use it when adequate.

Enters a state in which the application waits for system messages.

Called by Application.Run. Don't call this directly, the LCL will use it when adequate.

Main processing loop for the application. Waits for arrival of a message. Don't call this directly, the LCL will use it when adequate. Handles all pending messages.

Called by Application.ProcessMessages. Don't call this directly, the LCL will use it when adequate.

Terminates the application.

Called by Application.Terminate. Don't call this directly, the LCL will use it when adequate.

Minimizes the whole application to the taskbar.

Called by Application.Minimize. Don't call this directly, the LCL will use it when adequate.

Restore application previously minimized to the taskbar.

Called by Application.Restore. Don't call this directly, the LCL will use it when adequate.

Brings the entire application on top of all other non-topmost programs.

Called by Application.BringToFront. Don't call this directly, the LCL will use it when adequate.

Sets the icon in the taskbar.

Don't call this directly, the LCL will use it when adequate.

Sets the title for an application.

Don't call this directly, the LCL will use it when adequate.

Changes the visibility of the application window.

Don't call this directly, the LCL will use it when adequate.

Resets all StayOnTop windows to NoTopmost.

Don't call this directly, the LCL will use it when adequate.

False on failure. Sets all windows in the StayOnTop list to TopMost. Shows or hides the taskbar icon for the MainForm. The visibility of the MainForm icon in the TaskBar. Returns the name for the widgetset used for the platform. Widgetset in use for the platform. Checks whether the widgetset supports the specified LCL capability.

GetLCLCapability is a PtrUInt function used to determine if a specific LCL capability is supported in the widgetset implementation.

ACapability contains a TLCLCapability enumeration value examined in the method. The value identifies a feature or behavior in the LCL.

The return value is either LCL_CAPABILITY_NO or LCL_CAPABILITY_YES. LCL_CAPABILITY_YES indicates that the capabiity is implemented for the platform.

GetLCLCapability is overridden in descendent classes to return a value valid for the platform-specific implementation. The implementation in TWidgetSet handles the capabilities common to all widgetsets supported in the LCL. It is called when the descendent class does not handle the value in ACapability.

TWidgetSet returns LCL_CAPABILITY_YES for the following enumeration values:

  • lcCanDrawOutsideOnPaint
  • lcNeedMininimizeAppWithMainForm
  • lcApplicationTitle
  • lcFormIcon
  • lcModalWindow
  • lcReceivesLMClearCutCopyPasteReliably
  • lcSendsUTF8KeyPress
  • lcEmulatedMDI
  • lcNativeTaskDialog
  • lcAccelleratorKeys

All other enumeration values in TLCLCapability return LCL_CAPABILITY_NO.

Can be either LCL_CAPABILITY_NO or LCL_CAPABILITY_YES. TLCLCapability enumeration value checked in the method. Gets the color for a pixel on the specified device context.

Defined as an abstract virtual method. Must be implemented in a descendent class to use the image format and device context needed for the platform.

Sets the color for a pixel on the specified device context.

Defined as an abstract virtual method. Must be implemented in a descendent class to use the image format and device context needed for the platform.

Redraws the device context for the specified canvas handle.

Used in the implementation of the TCanvas.RealizeAutoRedraw method called when its AutoRedraw property is changed.

Implemented for Gtk, Gtk2, Carbon, and Cocoa widgetsets.

Canvas handle with the device context for the redraw operation. Enables or disables anti-aliasing for the specified device context.

Called from the RealizeAntiAliasing method in TCanvas when its handle or AntialiasingMode property is changed.

Canvas handle with the device context updated in the method. True to enable anti-aliasing for the device context. Initializes a font object to a (predefined) stock font. False on failure. The font to initialize. The predefined font to use for the initialization. Checks whether the widgetset uses the key to show help. True when this is a Help key. The virtual key. The modifier key state. Creates a timer with the given callback method. The timer ID, zero on failure. The time interval. The callback method. Destroys a timer.

Declared as an abstract virtual method in TWidgetSet. Must be implemented in a descendent class to use the platform-specific mechanism(s) required for the implementation.

False on failure. The timer ID. Native handle for a TApplication instance.

AppHandle is a platform-specific property. The meaning and use for the handle changes from widgetset to widgetset.

Use Arc to draw an elliptically curved line with the current Pen.

The arc is part of the ellipse inscribed in the bounding rectangle.

The angles angle1 and angle2 are 1/16th of a degree. For example, a full circle equals 5760 (16*360). Positive values of Angle and AngleLength mean counter-clockwise while negative values mean clockwise direction. Zero degrees is at the 3 o'clock position.

False on failure. base angle. angle length. Use AngleChord to draw a filled Chord shape on a canvas.

The chord is outlined with the current pen, and filled with the current brush.

The angles angle1 and angle2 are 1/16th of a degree. For example, a full circle equals 5760 16*360). Positive values of Angle and AngleLength mean counter-clockwise while negative values mean clockwise direction. Zero degrees is at the 3 o'clock position.

False on failure. Base angle. Angle length. Start painting in a window.

This function is for use in WM_PAINT handlers only. Not all platforms allow for painting outside WM_PAINT messages.

BeginPaint prepares the specified window for painting and fills a PAINTSTRUCT structure with information about the painting.

A Device Context for the window, Nil on failure. The window Handle. Will receive painting information. Copies part of a source DC into a destination DC, using the specified raster operation.

This routine implements the equivalent Windows GDI API of the same name in all platforms supported by Lazarus.

It copies a section of a Canvas to another one, without any stretching. It allows one to select the kind of operation which should be performed to draw the pixels into the destination in the parameter ROP. Allowed operations go from simply copying the pixels without change to inverting them and also to executing logical operations involving the source pixels and the previously existing pixels in the destination Canvas.

For normal usage one should only use SRCOPY in the ROP parameter, other operations may not be supported by all widgetsets.

There exist 16 raster operations, according to the possible combinations of two (boolean) values. Excluding the NOP case, that doesn't modify the target area, the possible values for ROP are:

  • BLACKNESS - Fills the destination rectangle with black
  • DSTINVERT - Inverts the colors of the destination area
  • MERGECOPY -
  • MERGEPAINT -
  • NOTSRCCOPY -
  • NOTSRCERASE -
  • PATCOPY -
  • PATINVERT -
  • PATPAINT -
  • SRCAND -
  • SRCCOPY -
  • SRCERASE -
  • SRCINVERT -
  • SRCPAINT - Combines the colors of the source and the destination using the operator OR on each pixel
  • WHITENESS - Fills the destination rectangle with white

These flags can be added to above ROPs:

CAPTUREBLT
Includes windows which are on top of the specified Canvas. This option is not recommended and is very hard to implement in all supported platforms.
NOMIRRORBITMAP
Prevents the bitmap from being mirrored. (The coordinates are sorted before painting?)
False on failure. The destination Device Context. The origin in the destination DC. The origin in the destination DC. The image size. The image size. The source Device Context. The origin in the source DC. The origin in the source DC. The raster operation. Calls the next procedure in the hook chain. Depends on the Hook type. Handle of the current hook. The Hook code (message ID). Message parameter. Message parameter. Calls another Window procedure, to handle a message. Converts (relative) Client coordinates into absolute Screen coordinates. False on failure. The window with the client area. The point to convert. Combines two regions.

The Destination must already be initialized. The Return value is the Region type for the Destination, or ERROR (0).

fnCombineMode can be one of:

RGN_AND
Gets a region of all points which are in both source regions.
RGN_COPY
Gets an exact copy of the first source region.
RGN_DIFF
Gets a region of all points which are in the first source region but not in the second.(Src1 - Src2).
RGN_OR
Gets a region of all points which are in either the first source region or in the second.(Src1 + Src2).
RGN_XOR
Gets all points which are in either the first Source Region or in the second, but not in both.
The Destination's Region type, or ERROR (0). The Handle of the destination region. This region must already exist! The handle of a region to combine. The handle of a region to combine. How the regions are combined. Creates a bitmap for the widgetset. Creates a bitmap with the specified width, height, and color format (color planes and bits per pixel). The bitmap Handle, zero on failure. The number of color planes. The number of color bits per pixel and plane. Pointer to array containing color data. Creates a logical brush that has the specified style, color, and pattern. The brush Handle, zero on failure. Description of the brush. Creates a new shape for the system caret and assigns ownership of the caret to the specified window. False on failure. The window that owns the caret. Bitmap Handle, or zero for a solid (black) caret, 1 for a grey caret. Creates a bitmap that is compatible with the given DC. The bitmap handle, zero on failure. The Device Context for the bitmap. Creates a memory Device Context, compatible with the device for the given DC. The memory DC, zero on failure. The device DC. Creates a Device Dependent Bitmap (DDB) from a Device Independent Bitmap (DIB). The bitmap handle, zero on failure. The context for the DDB. An array containing the bitmap pixels. CBM_INIT when InitBits contains valid data, else zero. Creates a bitmap into which the application can write. The bitmap Handle, zero on failure. The DC for the bitmap. Contains all information about the bitmap, except the pixels. The type of the bitmap colors, e.g. DIB_RGB_COLORS. Pointer to the bitmap pixels. Zero or the Handle of a file-mapping object, from which the bitmap is initialized (needs CreateFileMapping). The offset to the bitmap bits in the file-mapping object. Creates an elliptic region, bounded by the given rectangle. The region Handle, zero on failure. Creates a logical font, selectable into any DC. The font handle, zero on failure. The font description. Creates a logical font, selectable into any DC. Allows for a long font name. The font handle, zero on failure. The font description. The font name, can be longer than 32 characters. Creates an icon or cursor. The Handle, zero on failure. Creates a logical palette, selectable into any DC. The palette Handle, zero on failure. Creates a logical brush, selectable into any DC.

The bitmap pattern is repeated for areas of larger width or height, it should allow for smooth transitions.

Monochrome bitmaps obtain the actual text (0) or background (1) color of the DC.

The brush handle, zero on failure. The bitmap to use for the brush. Creates a logical Pen, selectable into any DC. The pen Handle, zero on failure. Creates a polygonal region.

The Points parameter is an array of points that give the vertices of the polygon. The connections between two points can cross others.

FillMode determines what points are going to be included in the region. When FillMode=Winding points are selected by using the Winding fill algorithm. When FillMode=ALTERNATE points are selected by using using the even-odd (alternative) fill algorithm.

The last point is connected to the first point to close the region.

The region Handle, zero on failure. The array of points. The number of points in Points. Can be ALTERNATE or WINDING. Creates a rectangular region. The region handle, zero on failure. Creates a rectangular region with rounded corners. The region Handle, zero on failure. The extent of the ellipse, used for the rounded corners. The extent of the ellipse, used for the rounded corners. Deletes an unowned critical section. Results are unpredictable when the section is owned, i.e. has been entered but not yet left. The critical section object. Deletes a Device Context created using CreateDC. False on failure. Deletes a graphic object, freeing all system resources associated with the object. The function fails when the Handle has been selected into a DC. False on failure. Destroys the caret but doesn't free the bitmap. False on failure. Handle of the window with the caret. Destroys a mouse cursor. False on failure. The cursor Handle. Destroys an icon. False on failure. Converts an array of Device Points (coordinates) into Logical Points. False on failure. The device context, containing the coordinate mapping information. An array of points. The number of points to convert. Draws a window frame control, of the specified type and style.

A window frame includes these components (uType):

  • title bar (DFC_CAPTION)
  • menu bar (DFC_MENU)
  • popup menus (DFC_POPUPMENU)
  • scrollbars (DFC_SCROLL)

Window managers do not normally allow the user to paint the components for a window frame, and do not supply a DC for that purpose.

The available features depend on the window manager for the platform, and the capabiities for the widgetset.

False on failure. The window frame device context. The control type, e.g. DFC_CAPTION. The control state, e.g. DFCS_CAPTIONCLOSE (close button). Shows or hides a focus rectangle.

This function is intended to temporarily outline part of a canvas, e.g. a rectangular selection following mouse moves (rubber banding box, DockRect).

A second call of the function, with the same parameters, removes the rectangle (XOR painting). Due to this behavior the frame should be removed before it might be overwritten by any other painting operation.

Not all platforms allow for painting outside WM_PAINT events. Child windows may be excluded (clipped), i.e. the rectangle is not necessarily fully shown.
False on failure. Almost a screen DC. Draws one or more edges of a rectangle. False on failure. Device context for the drawing operation. Rectangle with the bounds for the drawing operation. A combination of edge styles (inner/outer, raised/sunken). Indicates e.g. the edges to paint (BF_LEFT). Draws formatted text within a rectangle.

Several formatting options are available for use in the Flags argument. The value correspond to the DrawText constants defined in the lcltype.pp unit.

DT_CALCRECT suppresses all painting, and calculates the extent for the formatted text returned in the Rect parameter.

The height for the rendered text, calculated from values in Rect. Zero on failure. Device context for the text rendering operation. The text (should be zero terminated). The number of (Wide)Chars in the text. The bounding (clipping) rectangle. Formatting flags applied in the method. Enables or disables the arrows in a scrollbar control, or the scrollbars in a window. False when nothing was changed. The window or control handle. The scrollbar type (SB_CTL, SB_HORZ...). The affected buttons. Enables or disables mouse and keyboard input to the specified window or control. True when the window was disabled before. Handle for the window. True to enable the window, False to disable the window. Ends a paint operation in a window, started with BeginPaint. Almost nonzero. The window to paint. Painting information. Enters a critical section. The call returns only when the calling thread has obtained ownership of the critical section. See TryEnterCriticalSection for testing the ownership of the critical section. The critical section object. Calls a callback function for every available display monitor. False on failure. The callback function. Data passed to the callback function. Invokes a callback function for every font available on a specified device. The last value returned by the callback function. The device context. The font family name, empty for all families. The callback function. Data passed to the callback function. Invokes a callback function for every available font that matches certain criteria. The last value returned by the callback function. The device context. Description of the desired fonts. The callback function. Data passed to the callback function. Draws a filled circle or ellipse, bounded by a rectangle. The ellipse is outlined with the current pen, and filled with the current brush. False on failure. Excludes a rectangle from the clipping region, i.e. prevents painting within the rectangle. The type of the new clipping region, Error (0) on failure. Creates a logical pen, selectable into any DC. The pen handle, zero on failure. A collection of style options. The pen width. The brush description. The number of sections for a dashed pen. Array of the section lengths in a dashed pen. Draws a string without formatting (single line).

The string is drawn with the current font and colors. The following Options are supported:

ETO_CLIPPED
The text is clipped to the given rectangle.
ETO_OPAQUE
The rectangle is filled with the background color.
False on failure. The Device Context. The reference point, used to position the text. The reference point, used to position the text. Output options. The bounding rectangle. The text. The number of (Wide)Chars in the string. Pointer to an array of inter-character spacing values, can be Nil. Combines the passed Region with the current clipping region.

The Mode can be one of:

RGN_AND
All points which are in both regions.
RGN_COPY
An exact copy of the source region, same as SelectClipRGN.
RGN_DIFF
All points which are in the Clipping Region but but not in the Source. (Clip - RGN).
RGN_OR
All points which are in either the Clip Region or in the Source. (Clip + RGN).
RGN_XOR
All points which are in either the Clip Region or in the Source, but not in both.
The type of the resulting clipping region. The region to combine with. How the regions are combined. Fills a rectangle using the specified brush. False on failure. Fills a region using the specified brush. Fills an area of the display surface with the current brush.

FillStyle specifies the area:

  • When FillStyle is fsBorder, the area is bounded by a certain Color, the boundary must not have gaps in it.
  • When FillStyle is fsSurface, the area has the specified Color, and all adjacent pixels of this color are replaced.

Filling starts at a given point, which resides somewhere inside the area.

False on failure. The device context. The starting point. The starting point. The area or boundary color, depending on FillStyle. fsBorder or fsSurface. The brush used to fill the area. Draws a border around a rectangle. The boundary is one logical unit wide, painted using the given brush. Zero on failure. The rectangle to outline. The brush for drawing the border. Returns the Handle of the active window of the calling thread. The window handle, zero on failure. Fills a buffer with the bitmap bits. The number of bytes copied, zero on failure. The (device dependent) bitmap handle. The byte size of the buffer. Pointer to the output buffer. Returns the background color of a device context. The background color, CLR_INVALID on failure. Returns the window that captures mouse messages. The window handle, zero if no window of the thread captures mouse messages. Returns the caret position, in client coordinates. False on failure. Receives the coordinates. Returns the client rectangle of a window.

The client rectangle is the size of the inner area of a control, where e.g. the child controls are visible. Left and Top are always 0.

A child control with Align=alClient will completely fill the client rectangle.

False on failure. The window handle. Receives the client coordinates. Returns the smallest rectangle which includes the entire clipping region of a device context. The region kind. The device context. Receives the coordinates. Returns the clipping region of a device context. Zero on failure. The device context. The handle of the clipping region. Returns the currently selected object in a device context. The object handle, zero on failure. The device context. The type of the selected object, e.g. OBJ_BRUSH. Gets the mouse cursor position, in screen coordinates. False on failure. Receives the mouse coordinates. Returns the ABC widths of a range of character codes. _ABC False on failure. The device context. The first character code. The last character code. Array of ABC records, receiving the information. Returns the handle for the Device Context (DC) in the client area of a window. The DC handle, zero on failure. The window handle. Returns various device specific information.

The following information can be retrieved:

HORZSIZE
Horizontal size in millimeters.
VERTSIZE
Vertical size in millimeters.
HORZRES
Horizontal width in pixels.
VERTRES
Vertical height in pixels.
BITSPIXEL
Number of bits per pixel.
PLANES
Number of color planes.
LOGPIXELSX
The number of pixels per logical inch, in X (horizontal) direction.
LOGPIXELSY
The number of pixels per logical inch, in Y (vertical) direction.
SIZEPALETTE
Number of entries in the color palette.
NUMRESERVED
Number of reserved entries in the color palette.
HORZRES
The requested value. The device context. The value type, e.g. HORZRES. Fills a buffer with bitmap color bits.

The bitmap must be a compatible (device dependent) bitmap, for the given device context. It should not be selected into any DC.

The color bits are copied into the Bits array in Device Independent Bitmap (DIB) format.

When Bits is Nil, the BitInfo record receives the bitmap information, from which the required size of the Bits array can be determined.

DIB_RGB_COLORS
The number of returned scanlines, zero on failure. The device context. The bitmap handle. The first scanline to retrieve. The number of scanlines to retrieve. Pointer to the color bits array, or Nil to get the BitmapInfo. Contains or receives the BitmapInfo. The color format, e.g. DIB_RGB_COLORS. Returns the double-click time, in milliseconds. Returns the handle of the window that has the focus in the current thread. The window handle, zero if no window has the focus. Returns language information about the currently selected font.

The following flags are supported:

GCP_DBCS
the character set is double-byte (DBCS).
Font flags, zero for Latin font families. Returns the window that the user is currently working with, session wide. The window handle, zero when no such window exists. Returns information about an Icon or Cursor. The item handle. Receives the information. The status of a virtual key.

The result reflects the message processing state, at the time of the last seen key message.

A key can be up, down or toggled.

The high order bit of the result is the up/down state, 1 for down.

The low order bit of the result is the toggled state, applicable to e.g. the caps-lock key. The bit is set if the key is toggled (active).

The key state flags. The virtual key code. Returns the mapping mode of a device context. The mapping mode, zero on failure. The device context. Returns information about a display monitor. False on failure. The monitor handle. Receives the information. Returns information about a graphics object. The returned information depends on the object type The number of bytes written into the buffer. The Handle of the object. The byte count of the buffer. Receives the information. Nil means to return the required buffer size. Retrieves a range of color entries from a logical palette. The number of entries copied. The palette handle. The first entry. The number of entries to retrieve. Array of PALETTEENTRY records, receiving the information. Returns the parent window of a window. The parent window handle, zero on failure. The window handle. Retrieves a property value for a window. Nil on failure. The window handle. The property name. Returns the bounding rectangle of a region, containing the entire region. The region kind. The region handle. Receives the coordinates. The current Foreground Mixing Mode in a device context. R2_COPYPEN The mode, zero on failure. The device context. Returns all or selected information about a ScrollBar. False on failure. The handle of a ScrollBar, or of a window containing scrollbars. The ScrollBar kind. Receives the values indicated in fMask. Retrieves a handle to one of the predefined graphic objects.

These are the predefined (Windows) stock objects:

  • BLACK_BRUSH
  • DKGRAY_BRUSH
  • DC_BRUSH
  • GRAY_BRUSH
  • HOLLOW_BRUSH
  • LTGRAY_BRUSH
  • NULL_BRUSH
  • WHITE_BRUSH
  • BLACK_PEN
  • DC_PEN
  • WHITE_PEN
  • ANSI_FIXED_FONT
  • ANSI_VAR_FONT
  • DEVICE_DEFAULT_FONT
  • DEFAULT_GUI_FONT
  • OEM_FIXED_FONT
  • SYSTEM_FONT
  • SYSTEM_FIXED_FONT
  • DEFAULT_PALETTE
The handle, zero on failure. The object kind. Retrieves the system color for standard display elements.

These are the available display elements:

  • COLOR_3DDKSHADOW
  • COLOR_3DFACE, COLOR_BTNFACE
  • COLOR_3DHIGHLIGHT, COLOR_3DHILIGHT, COLOR_BTNHILIGHT, COLOR_BTNHIGHLIGHT
  • COLOR_3DLIGHT
  • COLOR_3DSHADOW, COLOR_BTNSHADOW
  • COLOR_ACTIVEBORDER
  • COLOR_ACTIVECAPTION
  • COLOR_APPWORKSPACE
  • COLOR_BACKGROUND, COLOR_DESKTOP
  • COLOR_BTNTEXT
  • COLOR_CAPTIONTEXT
  • COLOR_GRADIENTACTIVECAPTION
  • COLOR_GRADIENTINACTIVECAPTION
  • COLOR_GRAYTEXT
  • COLOR_HIGHLIGHT
  • COLOR_HIGHLIGHTTEXT
  • COLOR_HOTLIGHT
  • COLOR_INACTIVEBORDER
  • COLOR_INACTIVECAPTION
  • COLOR_INACTIVECAPTIONTEXT
  • COLOR_INFOBK
  • COLOR_INFOTEXT
  • COLOR_MENU
  • COLOR_MENUHILIGHT
  • COLOR_MENUBAR
  • COLOR_MENUTEXT
  • COLOR_SCROLLBAR
  • COLOR_WINDOW
  • COLOR_WINDOWFRAME
  • COLOR_WINDOWTEXT

Since all returned values are valid colors, errors cannot be detected. GetSysColorBrush instead returns a zero handle on failure.

The RGB color. The system color type. Retrieves a system brush for standard display elements. The brush handle, zero on failure. The system color type. Retrieves a range of color entries from the system palette for a device. The number of entries copied, zero on failure. The device context. The first entry to retrieve. The number of requested entries. Receives the color information. When Nil, the total number of palette entries is returned. Retrieves various system metrics.

All dimensions are measured in pixels.

These are the available system metrics parameters:

  • SM_ARRANGE
  • SM_CLEANBOOT
  • SM_CMONITORS
  • SM_CMOUSEBUTTONS
  • SM_CXBORDER
  • SM_CYBORDER
  • SM_CXCURSOR
  • SM_CXCURSOR
  • SM_CXDLGFRAME
  • SM_CYDLGFRAME
  • SM_CXDOUBLECLK
  • SM_CXDOUBLECLK
  • SM_CXDRAG
  • SM_CXDRAG
  • SM_CXEDGE
  • SM_CXEDGE
  • SM_CXFIXEDFRAME
  • SM_CYFIXEDFRAME
  • SM_CXFOCUSBORDER
  • SM_CXFRAME
  • SM_CYFRAME
  • SM_CXFULLSCREEN
  • SM_CYFULLSCREEN
  • SM_CXHSCROLL
  • SM_CYHSCROLL
  • SM_CXHTHUMB
  • SM_CXICON
  • SM_CYICON
  • SM_CXICONSPACING
  • SM_CYICONSPACING
  • SM_CYMAXIMIZED
  • SM_CYMAXIMIZED
  • SM_CXMAXTRACK
  • SM_CYMAXTRACK
  • SM_CXMENUCHECK
  • SM_CYMENUCHECK
  • SM_CXMENUSIZE
  • SM_CYMENUSIZE
  • SM_CXMIN
  • SM_CYMIN
  • SM_CXMINIMIZED
  • SM_CYMINIMIZED
  • SM_CXMINSPACING
  • SM_CYMINSPACING
  • SM_CXMINTRACK
  • SM_CYMINTRACK
  • SM_CXSCREEN
  • SM_CYSCREEN
  • SM_CXSIZE
  • SM_CYSIZE
  • SM_CXSIZEFRAME
  • SM_CYSIZEFRAME
  • SM_CXSMICON
  • SM_CYSMICON
  • SM_CXSMSIZE
  • SM_CYSMSIZE
  • SM_CXVIRTUALSCREEN
  • SM_CYVIRTUALSCREEN
  • SM_CXVSCROLL
  • SM_CYVSCROLL
  • SM_CYCAPTION
  • SM_CYKANJIWINDOW
  • SM_CYMENU
  • SM_CYSMCAPTION
  • SM_CYVTHUMB
  • SM_DBCSENABLED
  • SM_DEBUG
  • SM_IMEENABLED
  • SM_MEDIACENTER
  • SM_MENUDROPALIGNMENT
  • SM_MIDEASTENABLED
  • SM_MOUSEPRESENT
  • SM_MOUSEWHEELPRESENT
  • SM_NETWORK
  • SM_PENWINDOWS
  • SM_REMOTECONTROL
  • SM_REMOTESESSION
  • SM_SECURE
  • SM_SAMEDISPLAYFORMAT
  • SM_SHOWSOUNDS
  • SM_SHUTTINGDOWN
  • SM_SLOWMACHINE
  • SM_SWAPBUTTON
  • SM_TABLETPC
  • SM_XVIRTUALSCREEN
  • SM_YVIRTUALSCREEN
Depends on the requested item. The requested item. The current text color in a device context. The RGB color. The device context. Calculates the number of characters, that fit into some horizontal space. False on failure. The device context. The string containing the characters. The number of bytes in Str, -1 for automatic detection. The maximum display width, in logical units. Receives the number of logical (UTF) characters that can be displayed. When Nil, MaxWidth is ignored. Receives the widths for every partial sequence of characters. Can be Nil. Receives the total width and height of the display area. Computes the display width and height of a string. May not work properly without Unicode support. False on failure. The display DC. The text. The number of bytes in Str, -1 for automatic detection. Receives the total width and height of the required display area. Computes the display width and height for a string. Retrieves the metrics for the currently selected font. False on failure. The device context, where the font is selected. Receives the information. Returns the size of the viewport for a device context. False (zero) on failure. Receives the viewport size. Returns the origin of the viewport for a device context. False (zero) on failure. Receives the viewport origin. Returns the extent of a window, in logical units. False (zero) on failure. Receives the window extent. Returns the attributes of a window.

The following attributes are defined:

GWL_EXSTYLE
extended window style flags. See CreateWindowEx.
GWL_STYLE
window style flags.
GWL_WNDPROC
the window procedure (address or handle). See CallWindowProc.
GWL_HINSTANCE
handle of the application instance.
GWL_HWNDPARENT
handle of the parent window.
GWL_ID
the identifier of the window.
GWL_USERDATA
user data associated with the window.

The following attributes are also available when the window is a dialog box:

DWL_DLGPROC
the dialog box procedure (address or handle).
DWL_MSGRESULT
the return value of a message processed in the dialog box procedure.
DWL_USER
extra application information.

GWL_USERDATA and DWL_USER are the base offsets of user added attributes. The second user attribute can be access with an additional offset of 4, and so on.

The attribute. The window handle. Offset of the attribute. Retrieves the bounding rectangle of a window, in screen coordinates. Zero on failure. The window handle. Receives the window bounds. Returns the Width and Height of the window.

The size value is the client width and height for forms, or the total combined size for sub-controls.

False on failure. The window handle. The width. The height. Retrieves the window origin for a device context in logical units. Zero on failure. The device context. Receives the origin. Fills rectangle or triangle areas with gradient colors. False on failure. The device context. E.g. GRADIENT_FILL_RECT_H. Removes the caret from the screen.

Calls are cumulative; for every HideCaret a call to ShowCaret is required to undo the action.

False on failure. The window handle, can be zero. Initializes a Critical Section object.

Critical sections are thread synchronization elements, typically used to prevent concurrent access to a shared resource.

Only one thread can own a critical section at the same time, other requests (to enter the same critical section) are delayed until the owner has left the critical section.

The TCriticalSection type is platform specific. It is treated like a Handle.

The critical section object. Shrinks the clipping region of an Device Context to a rectangular boundary, e.g. a text area.

Use this method before painting into a rectangle in an DC, to clip everything outside the rectangle and outside the current clipping region of the DC.

The result can be one of the following constants:
Error NullRegion SimpleRegion ComplexRegion Region_Error.

The region type, zero on failure. Marks a display area for repaint. False on failure. The window handle. The client coordinates of the area. True forces a repaint of the background, before further painting. Marks a display area for repaint. False on failure. The window handle. The region to repaint. True forces a repaint of the background, before further painting. True when the character code is the first of a double-byte character sequence. The character code to test. True when the window is minimized. True when the window is minimized. The window handle. Checks whether a handle refers to a window. True when handle is a valid window handle. The handle to test. Determines whether a window can receive mouse and keyboard input. True when the window is enabled (and visible). The window handle. The definite Visible state of a window. True when the window and all its parents are visible. True when the window is maximized. True when the window is maximized. The window handle. Releases a critical section, and allows use by other threads. The critical section object. Draws a line from the current position up to, but not including, the specified point. The current position is set to the given endpoint. False on failure. The device context. The endpoint in logical units. The endpoint in logical units. Converts logical coordinates into device coordinates. False on failure. The device context. Holds and receives the transformed coordinates. The number of points in Points. Copies part of a source DC into an destination DC, using the specified foreground and background raster operations.

MaskBlt behaves like BitBlt when no mask bitmap is specified. It does a SRCOPY operation when also no Rop is specified. See BitBlt for general information about raster operations.

Rop contains both a foreground and a background raster operation (see MakeROP4). When a (monochrome) mask bitmap is present, its bits select either the foreground (1) or background (0) raster operation.

MakeROP4
False on failure. The destination device context. The origin of the destination rectangle. The origin of the destination rectangle. The size of the destination rectangle. The size of the destination rectangle. The source device context. The origin of the source rectangle. The origin of the source rectangle. The monochrome mask bitmap handle, can be zero. The origin of the mask rectangle. The origin of the mask rectangle. The raster operations (optional). Displays a modal dialog message box.

The MessageBox function displays a modal dialog with the given text, caption, icon and buttons.

uType is a combination of flags from the following lists.

The shown buttons are selected by one of:

MB_ABORTRETRYIGNORE
Abort, Retry, and Ignore.
MB_CANCELTRYCONTINUE
Cancel, Try Again, Continue. Use this message box type instead of MB_ABORTRETRYIGNORE.
MB_OK
OK.
MB_OKCANCEL
OK and Cancel.
MB_RETRYCANCEL
Retry and Cancel.
MB_YESNO
Yes and No.
MB_YESNOCANCEL
Yes, No, and Cancel.

Add MB_HELP for an Help button. When the user clicks the Help button or presses F1, the owner window receives a WM_HELP message.

An icon can be added by one of:

MB_ICONEXCLAMATION, MB_ICONWARNING
Exclamation point icon
MB_ICONINFORMATION, MB_ICONASTERISK
The letter "i" in a circle
MB_ICONQUESTION
Question mark icon
MB_ICONSTOP, MB_ICONERROR, MB_ICONHAND
Stop sign icon

The default button number, activated when the user presses Enter, can be indicated by one of:

  • MB_DEFBUTTON1
  • MB_DEFBUTTON2
  • MB_DEFBUTTON3
  • MB_DEFBUTTON4

Other Windows MessageBox-specific options are not (yet) implemented on other platforms.

The function result corresponds to the button pressed:

  • IDABORT
  • IDCANCEL
  • IDCONTINUE
  • IDIGNOE
  • IDNO
  • IDOK
  • IDRETRY
  • IDTRYAGAIN
  • IDYES
The pressed button, or zero on failure. The handle of the window that owns the MessageBox. The text displayed in the MessageBox. The caption of the MessageBox. Style flags specifying the shown buttons etc. Finds a monitor from the screen coordinates.

The return value contains the handle for the monitor, or a value determined using Flags when a monitor does not apply.

MONITOR_DEFAULTTONEAREST
The nearest monitor.
MONITOR_DEFAULTTONULL
Zero.
MONITOR_DEFAULTTOPRIMARY
The primary monitor.
Gets the monitor handle, or a value derived from Flags. The point in screen coordinates. How coordinates outside any monitor are handled, see MonitorFromPoint. Finds the monitor covering most of a rectangle. The monitor handle; see dwFlags. The logical screen coordinates. How coordinates outside any monitor are handled; see MonitorFromPoint.Result. Finds the monitor covering most of a window. The monitor handle, see MonitorFromPoint.Result. The window handle. How coordinates outside any monitor are handled, see MonitorFromPoint.Result. Moves the current position to the specified point. False on failure. The device context. The new logical position. The new logical position. Receives the old position, can be Nil if not required. Moves a region relative. The new region kind, zero on failure. The Region to move. The relative distance to move. The relative distance to move. Checks the thread's message queue for a message. Receives the message. The target window handle of the message. Zero for any window, INVALID_HANDLE_VALUE for thread messages. The lowest message ID to retrieve. The highest message ID to retrieve, zero for all messages. PM_REMOVE will remove the message from the queue. Draws a filled pie-shaped wedge, from an ellipse and two radials.

The ellipse is bounded by a rectangle x1..y2.

Each radial is defined by the center of the rectangle an point, which must not necessarily reside on the ellipse. The bounding arc goes counter-clockwise from the Start to the End radial. The pie is outlined with the current pen and filled with the current brush.

False on failure. The device context. The bounding rectangle. The starting radial. The ending radial. Draws Bezier curves.

Use PolyBezier to draw cubic Bézier curves.

The first curve is drawn from the first point to the fourth point with the second and third points being the control points.

If the Continuous flag is True then each subsequent curve requires three more points, using the end-point of the previous Curve as its starting point.

If the Continuous flag is set to False, then each subsequent curve requires 4 additional points, which are used exactly as in the first curve.

If the Filled flag is set to True then a straight line is drawn from the last connected point to the starting point, and the entire curve is filled with the current brush.

Any additional points which do not add up to a full Bezier (4 for Continuous, 3 otherwise) are ignored. There must be at least 4 points to be connected.

False on failure. The device context. The array of points. The number of points in Points. True draws a Polygon. True uses the end-point as the starting point of the next segment. Draws a filled Polygon.

Use Polygon to draw a closed, many-sided shape on the canvas, outlined with the current Pen and filled with the current Brush.

The Points parameter is an array of the vertices of the polygon.

Winding determines how the polygon is filled. When Winding is True, Polygon fills the shape using the Winding fill algorithm. When Winding is False, Polygon uses the even-odd (alternative) fill algorithm.

The first point is always connected to the last point.

To draw an unfilled polygon use the Polyline method, specifying the first point a second time at the end.

False on failure. The device context. The array of vertices. The number of vertices. Selects the fill algorithm. Draws a sequence of lines.

Use Polyline to connect a set of points on the canvas.

The Points parameter is an array of points to be connected. If you specify only two points, Polyline draws a single line.

Calling the MoveTo function with the value of the first point, and then repeatedly calling LineTo with all subsequent points will draw the same image on the canvas. Unlike LineTo, Polyline does not change the value of PenPos.

Sends a message to a window, without waiting for the message result. This section was copied from LCLIntf, and may not apply to all platforms.

This method is a thread-safe solution to send messages to windows. Those messages will be handled in the message loop of the application and therefore can be sent from any thread. They are not immediate, but they will awake the main thread if it is waiting for messages.

These messages can be handled by procedures with the keyword message in the class of a form for example. One would then use the handle of this form as the Handle parameter of this routine.

Custom messages should always have an identification number (represented by the parameter Msg) larger then the constant LM_USER.

The two parameters WParam and LParam will be passed along to the window together with the Msg identification number.

The difference between SendMessage and PostMessage is the way that they return control to the calling thread. With SendMessage control is not returned until the window that the message was sent to has completed processing the sent message, however with PostMessage control is returned immediately.

Zero on failure. The target window handle. The message ID. Tests whether a point lies in a region. True when the point lies in the region. The region. The point coordinate. The point coordinate. Maps palette entries from the current logical palette to the system palette. The number of mapped entries. The device context. Draws a filled rectangle.

The rectangle is outlined with the current Pen, and filled with the current Brush. The bottom and right edges are not part of the rectangle.

False on failure. The device context. Checks whether the clipping region contains (part of) a rectangle. True when (part of) the rectangle is visible. The device context. The rectangle. Redraws (part of) a window.

All invalidated parts of a window, which deserve an update, are collected in the update region. When this region is not empty, WM_ERASEBKGND, WM_PAINT and WM_NCPAINT messages are sent to the window, as soon as the application is (almost) idle. RedrawWindow can be used to force an immediate redraw instead.

WM_ERASEBKGND is optional, erases the background before painting. WM_NCPAINT paints the non-client areas (borders, caption...), without assistance by user code.

When neither lprcUpdate nor hrgnUpdate are specified, the whole client area of the window is affected. Otherwise the region takes precedence over the rectangle.

Flags specify how the window is invalidated or validated, and when repainting occurs. Flags other than RDW_ERASE may not be supported by all platforms.

To invalidate specify RDW_INVALIDATE, and optionally one of:

RDW_ERASE
Forces a WM_ERASEBKGND message before painting.
RDW_FRAME
Also redraws the window frame, as covered by the update region.
RDW_INTERNALPAINT
Force WM_PAINT even if the update region is empty.

Validation is not implemented for all platforms. To validate, specify RDW_VALIDATE and optionally one of the following:

RDW_NOERASE
Sppress all pending WM_ERASEBKGND messages.
RDW_NOFRAME
Suppress all pending WM_NCPAINT messages.
RDW_NOINTERNALPAINT
Suppress all pending internal WM_PAINT messages.

These flags specify when repainting will occur:

RDW_ERASENOW
Send WM_ERASEBKGND messages before returning.
RDW_UPDATENOW
Send WM_PAINT messages before returning.

The handling of child windows normally depends on the WS_CLIPCHILDREN window style flag. Clipped child windows are not normally affected by RedrawWindow. These flags override:

RDW_ALLCHILDREN
Include all child windows.
RDW_NOCHILDREN
Exclude all child windows.
False on failure. The window to redraw. The rectangle to redraw, ignored when a region is given. The region to redraw, can be zero. How the redraw works. Restores normal mouse input processing, after SetCapture. False on failure. Releases an Device Context obtained by GetDC. Zero on failure. The handle of the window, whose DC is released. The device context to release. Removes a named property from a window. The handle of the removed data, zero on failure. The window handle. The name of the property to remove. Restores an Device Context (DC) to an previously saved state. False on failure. The device context. The index returned by SaveDC, or -1 for the most recently saved state. Draws a filled rectangle with rounded corners.

The rectangle is outlined with the current Pen, and filled with the current Brush.

False on failure. The device context. The rectangle coordinates. The extent of the ellipse, used for the rounded corners. The extent of the ellipse, used for the rounded corners. Saves the state of an Device Context in the context stack. The index of the saved DC, zero on failure. The device context to save. Converts absolute Screen coordinates into Client relative coordinates. False on failure. The handle of the window with the client area. The point to convert. Scrolls the content of a window, by a number of pixels.

The following flags values are defined:

SW_ERASE
When used with SW_INVALIDATE, sends WM_ERASEBKGND messages for the invalidated parts of the window.
SW_INVALIDATE
Invalidates the resulting hrgnUpdate region.
SW_SCROLLCHILDREN
Also scrolls child windows within the scroll rect. Beware: also scrolls parts of the child windows!
SW_SMOOTHSCROLL
set HIWORD of flags to the time for the scrolling operation.
False on failure. The window handle. Horizontal distance (positive to scroll right). Vertical distance (positive to scroll down). The part of the window, that is to be scrolled. Nil means the entire client area. Pixels falling outside this rectangle are lost. Nil means the entire client area. The invalidated parts of the window are added to this region (can be zero). Receives the boundary of the invalidated part of the window (can be Nil). Control flags. Sets the ClipRegion of an DeviceContext. The region kind. The device context. The region to copy, zero for an empty region. Selects an object into an device context. The previously selected object, for a region the new region type. The device context. The object to select. Selects a logical palette into an device context.

A foreground palette becomes the palette for the device when the application is in the foreground. A background palette instead is mapped to the closest colors in the palette for the physical device.

The handle of the previously selected palette. The device context. The palette to select. True to select the background palette. Sends a message to a window. This section was copied from LCLIntf, and may not apply to all platforms.

This method is a thread-safe solution to send messages to windows.

The messages will be handled in the message loop of the application and therefore can be sent from any thread. They are not immediate, but they will awake the main thread if it is waiting for messages.

Custom messages should always have an ID higher than the constant LM_USER.

The two parameters WParam and LParam will be passed to the message handler, together with the message ID.

The difference between SendMessage and PostMessage is the way that they return control to the calling thread. With SendMessage control is not returned until the window that the message was sent to has completed processing the sent message, however with PostMessage control is returned immediately.

The result depends on the message type. The handle of the target window. The message ID. Message parameter. Message parameter. Sets focus to the specified window, if the application is on top. The handle of the window that lost the focus, zero on failure. The window handle to activate. Sets the current background color of an device context. The old background color, CLR_INVALID on failure. The device context. The new background color. Sets the background mix mode (transparency) of an device context.

The background mode specifies the handling of non-solid painting objects, like text, hatched brushes or dotted pens.

  • OPAQUE mode fills the affected painting area with the background color before painting the foreground.
  • TRANSPARENT mode leaves the background unchanged.
The previous background mode, zero on failure. The device context. The new background mode. Sets the mouse capture to the specified window. The window will receive all mouse messages, until capture is released again. The handle of the previous capture window, zero if none. The handle of the capturing window. Moves the Caret to the specified coordinates. False on failure. The new caret position. The new caret position. Moves the Caret into a window. False on failure. The window handle. The new caret position. The new caret position. Changes the shape of the mouse cursor. TCursor The handle of the previous cursor, zero if none. The new cursor handle. Changes the position of the mouse cursor. False on failure. The new screen coordinates. The new screen coordinates. Sets the keyboard input focus to the specified window. The handle of the previously focused window, zero if none. The handle of the window receiving the focus. Moves a window in front of all other windows, and activates it. False on failure. The window handle. Sets the mapping mode of an device context.

The mapping mode specifies the correspondence between logical and physical units. Supported modes are:

MM_ANISOTROPIC
Arbitrary mapping
MM_HIENGLISH
0.001 inch
MM_HIMETRIC
0.01 mm
MM_ISOTROPIC
Arbitrary mapping, same for X and Y axis
MM_LOENGLISH
0.01 inch
MM_LOMETRIC
0.1 mm
MM_TEXT
1 device pixel
MM_TWIPS
1/20th point (twip, 1/1440 inch)

Positive X is right, except for (an)isotropic mappings. Positive Y is up, except for (an)isotropic and MM_TEXT mappings.

The old mapping mode. The device context. The new mapping mode. Assigns a menu to a window. False on failure. The window handle. The menu handle. Changes the parent of a window. The handle of the previous parent window, zero if none or failure. The handle of the child window. The handle of the new parent window, zero for the desktop window. Adds a property to a window. False on failure. The window handle. The property name. Pointer to the property data. Sets the Foreground Mixing Mode in a device context.

The raster operation specifies how foreground painting (Brush, Pen) is combined with the current pixels in the DC. The operation combines bitwise the distinct red, green and blue values in pixel colors.

There are 16 raster operations usig the possible combinations of two (boolean) values:

R2_BLACK
All black (0).
R2_COPYPEN
Pen color.
R2_MASKNOTPEN
Dst and not Pen.
R2_MASKPEN
Dst and Pen.
R2_MASKPENNOT
(Not Dst) and Pen.
R2_MERGENOTPEN
Dst or not Pen.
R2_MERGEPEN
Dst or Pen.
R2_MERGEPENNOT
(Not Dst) or Pen.
R2_NOP
Dst (unchanged).
R2_NOT
Not Dst.
R2_NOTCOPYPEN
Not Pen.
R2_NOTMASKPEN
Not (Dst and Pen).
R2_NOTMERGEPEN
Not (Dst or Pen).
R2_NOTXORPEN
Not (Dst xor Pen).
R2_WHITE
All white.
R2_XORPEN
Dst xor Pen.
R2_COPYPEN
The old mode, zero on failure. The device context. The new mode. Sets (selected) parameters of a scroll bar. The (new) slider position. The handle of a ScrollBar, or of a window containing scrollbars. The ScrollBar kind. Contains the new values. True forces a repaint of the ScrollBar. Sets the StrechBlt mode for an device context.

The following modes are defined:

  • BLACKONWHITE - preserves black pixels in a monochrome bitmap.
  • COLORONCOLOR
  • HALFTONE, STRETCH_HALFTONE
  • WHITEONBLACK - preserves white pixels in a monochrome bitmap.
The previous mode, zero on failure. The Device Context. The new mode. Sets the colors for one or more display elements of window borders and desktop. GetSysColor False on failure. The number of colors to change, size of the arrays. Array of element identifiers. Array of RGB colors. Sets extra inter-character spacing in text output. The previous spacing, $80000000 on failure. The device context. The additional spacing, in logical units. Sets the text color in a device context. The previous color, CLR_INVALID on failure. The Device Context. The new text color. Sets the extent of the viewport for a device context. False on failure. The Device Context. The extent in device units. The extent in device units. Receives the previous extent, if not Nil. Sets the device origin corresponding to the window origin (0,0) in a device context. False on failure. The Device Context. The coordinates in device units. The coordinates in device units. Receives the previous origin, if not Nil. Sets the extent of the window for an device context. False on failure. The Device Context. The extent in logical units. The extent in logical units. Receives the previous extent, if not Nil. Sets an attribute of a window. The previous value, zero on failure. The window handle. The attribute offset. The new value. Specifies which window point maps to the viewport origin (0,0). False on failure. The device context. The origin in logical units. The origin in logical units. Receives the previous origin, if not Nil. Changes the size, position, and Z order of a window.

The Z order can be changed to just behind another window, or:

HWND_BOTTOM
Behind all other windows.
HWND_NOTOPMOST
Behind all topmost windows.
HWND_TOP
Above all other windows.
HWND_TOPMOST
Above all other non-topmost windows.

The general placement can be a combination of:

SWP_ASYNCWINDOWPOS
Don't block the calling thread when the window is owned by a different thread.
SWP_DEFERERASE
Suppress WM_SYNCPAINT message.
SWP_DRAWFRAME
Draw the window frame.
SWP_FRAMECHANGED
Apply new frame style.
SWP_HIDEWINDOW
Hides the window.
SWP_NOACTIVATE
Don't activate the window.
SWP_NOCOPYBITS
Invalidate the entire client area. If not set, the window content moves together with the window.
SWP_NOMOVE
The position is not changed (ignores X, Y).
SWP_NOREPOSITION, SWP_NOOWNERZORDER
The Z order of the owner window is unchanged.
SWP_NOREDRAW
Nothing is redrawn automatically, not even uncovered parts of the window.
SWP_NOSENDCHANGING
No WM_WINDOWPOSCHANGING message.
SWP_NOSIZE
The size is unchanged (ignores cx, cy).
SWP_NOZORDER
The Z order is unchanged (ignores hWndInsertAfter)
SWP_SHOWWINDOW
Unhide the window.
Zero on failure. The window handle. The window handle or Z order position. The window origin. The window origin. The window extent. The window extent. General placement flags. Restricts the visible part of the entire window. False on failure. The window handle. The window region handle. True forces a repaint of the window. Shows the Caret (text cursor).

ShowCaret is a Boolean function used to display the caret or text cursor for the window handle specified in hWnd. The return value is True if the caret was successfully displayed in the method.

ShowCaret is a virtual method, and should be overridden in a descendent class to use the platform-specific mechanism(s) for the widgetset. The return value is always False in TWidgetSet.

Use HideCaret to remove the caret from the screen.

Use CreateCaret to create a new caret shape width the required size.

False on failure. The window handle. Shows or hides a ScrollBar. False on failure. The window or ScrollBar handle. The scrollbar type (SB_CTL, SB_HORZ...). True shows, False hides the ScrollBar. Shows a window in an specific state.

These are the available options in nCmdShow:

SW_FORCEMINIMIZE
Forces the window into its minimized state.
SW_HIDE
Hides the window.
SW_MAXIMIZE
Maximizes the window.
SW_MINIMIZE
Minimizes the window.
SW_RESTORE
Activates and restores from minimized/maximized to normal state.
SW_SHOW
Activates and shows the window.
SW_SHOWMAXIMIZED
Activates and maximizes the window.
SW_SHOWMINIMIZED
Activates and minimizes the window.
SW_SHOWMINNOACTIVE
Minimizes the window.
SW_SHOWNA
Shows the window.
SW_SHOWNOACTIVATE
Shows the window as designed.
SW_SHOWNORMAL
Activates and shows the window as designed.
True when the window was already visible. The window handle. Copies a rectangular region to a device context, shrinking or stretching it as needed. False on failure. The destination device context. The destination origin. The destination origin. The destination extent. The destination extent. The source device context. The source origin. The source origin. The source extent. The source extent. The raster opcode (see BitBlt). Copies a rectangular region from a DIB into an device context, shrinking or stretching it as required. The destination Device Context. The destination origin. The destination origin. The destination extent. The destination extent. The source origin. The source origin. The source extent. The source extent. The device independent bitmap bits. The bitmap info structure. The color mode. The raster operation. Retrieves or sets one of the system-wide parameters.

Most of the parameters are Windows platform specific.

  • SPI_GETACCESSTIMEOUT
  • SPI_GETFILTERKEYS
  • SPI_GETFOCUSBORDERHEIGHT
  • SPI_GETFOCUSBORDERWIDTH
  • SPI_GETHIGHCONTRAST
  • SPI_GETMOUSECLICKLOCK
  • SPI_GETMOUSECLICKLOCKTIME
  • SPI_GETMOUSEKEYS
  • SPI_GETMOUSESONAR
  • SPI_GETMOUSEVANISH
  • SPI_GETSCREENREADER
  • SPI_GETSERIALKEYS
  • SPI_GETSHOWSOUNDS
  • SPI_GETSOUNDSENTRY
  • SPI_GETSTICKYKEYS
  • SPI_GETTOGGLEKEYS
  • SPI_SETACCESSTIMEOUT
  • SPI_SETFILTERKEYS
  • SPI_SETFOCUSBORDERHEIGHT
  • SPI_SETFOCUSBORDERWIDTH
  • SPI_SETHIGHCONTRAST
  • SPI_SETMOUSECLICKLOCK
  • SPI_SETMOUSECLICKLOCKTIME
  • SPI_SETMOUSEKEYS
  • SPI_SETMOUSESONAR
  • SPI_SETMOUSEVANISH
  • SPI_SETSCREENREADER
  • SPI_SETSERIALKEYS
  • SPI_SETSHOWSOUNDS
  • SPI_SETSOUNDSENTRY
  • SPI_SETSTICKYKEYS
  • SPI_SETTOGGLEKEYS
  • SPI_GETDESKWALLPAPER
  • SPI_GETDROPSHADOW
  • SPI_GETFLATMENU
  • SPI_GETFONTSMOOTHING
  • SPI_GETFONTSMOOTHINGCONTRAST
  • SPI_GETFONTSMOOTHINGTYPE
  • SPI_GETWORKAREA
  • SPI_SETCURSORS
  • SPI_SETDESKPATTERN
  • SPI_SETDESKWALLPAPER
  • SPI_SETDROPSHADOW
  • SPI_SETFLATMENU
  • SPI_SETFONTSMOOTHING
  • SPI_SETFONTSMOOTHINGCONTRAST
  • SPI_SETFONTSMOOTHINGTYPE
  • SPI_SETWORKAREA
  • SPI_GETICONMETRICS
  • SPI_GETICONTITLELOGFONT
  • SPI_GETICONTITLEWRAP
  • SPI_ICONHORIZONTALSPACING
  • SPI_ICONVERTICALSPACING
  • SPI_SETICONMETRICS
  • SPI_SETICONS
  • SPI_SETICONTITLELOGFONT
  • SPI_SETICONTITLEWRAP
  • SPI_GETBEEP
  • SPI_GETBLOCKSENDINPUTRESETS
  • SPI_GETDEFAULTINPUTLANG
  • SPI_GETKEYBOARDCUES
  • SPI_GETKEYBOARDDELAY
  • SPI_GETKEYBOARDPREF
  • SPI_GETKEYBOARDSPEED
  • SPI_GETMOUSE
  • SPI_GETMOUSEHOVERHEIGHT
  • SPI_GETMOUSEHOVERTIME
  • SPI_GETMOUSEHOVERWIDTH
  • SPI_GETMOUSESPEED
  • SPI_GETMOUSETRAILS
  • SPI_GETSNAPTODEFBUTTON
  • SPI_GETWHEELSCROLLLINES
  • SPI_SETBEEP
  • SPI_SETBLOCKSENDINPUTRESETS
  • SPI_SETDEFAULTINPUTLANG
  • SPI_SETDOUBLECLICKTIME
  • SPI_SETDOUBLECLKHEIGHT
  • SPI_SETDOUBLECLKWIDTH
  • SPI_SETKEYBOARDCUES
  • SPI_SETKEYBOARDDELAY
  • SPI_SETKEYBOARDPREF
  • SPI_SETKEYBOARDSPEED
  • SPI_SETLANGTOGGLE
  • SPI_SETMOUSE
  • SPI_SETMOUSEBUTTONSWAP
  • SPI_SETMOUSEHOVERHEIGHT
  • SPI_SETMOUSEHOVERTIME
  • SPI_SETMOUSEHOVERWIDTH
  • SPI_SETMOUSESPEED
  • SPI_SETMOUSETRAILS
  • SPI_SETSNAPTODEFBUTTON
  • SPI_SETWHEELSCROLLLINES
  • SPI_GETMENUDROPALIGNMENT
  • SPI_GETMENUFADE
  • SPI_GETMENUSHOWDELAY
  • SPI_SETMENUDROPALIGNMENT
  • SPI_SETMENUFADE
  • SPI_SETMENUSHOWDELAY
  • SPI_GETLOWPOWERACTIVE
  • SPI_GETLOWPOWERTIMEOUT
  • SPI_GETPOWEROFFACTIVE
  • SPI_GETPOWEROFFTIMEOUT
  • SPI_SETLOWPOWERACTIVE
  • SPI_SETLOWPOWERTIMEOUT
  • SPI_SETPOWEROFFACTIVE
  • SPI_SETPOWEROFFTIMEOUT
  • SPI_GETSCREENSAVEACTIVE
  • SPI_GETSCREENSAVERRUNNING
  • SPI_GETSCREENSAVETIMEOUT
  • SPI_SETSCREENSAVEACTIVE
  • SPI_SETSCREENSAVERRUNNING
  • SPI_SETSCREENSAVETIMEOUT
  • SPI_GETCOMBOBOXANIMATION
  • SPI_GETCURSORSHADOW
  • SPI_GETGRADIENTCAPTIONS
  • SPI_GETHOTTRACKING
  • SPI_GETLISTBOXSMOOTHSCROLLING
  • SPI_GETMENUANIMATION
  • SPI_GETMENUUNDERLINES
  • SPI_GETSELECTIONFADE
  • SPI_GETTOOLTIPANIMATION
  • SPI_GETTOOLTIPFADE
  • SPI_GETUIEFFECTS
  • SPI_SETCOMBOBOXANIMATION
  • SPI_SETCURSORSHADOW
  • SPI_SETGRADIENTCAPTIONS
  • SPI_SETHOTTRACKING
  • SPI_SETLISTBOXSMOOTHSCROLLING
  • SPI_SETMENUANIMATION
  • SPI_SETMENUUNDERLINES
  • SPI_SETSELECTIONFADE
  • SPI_SETTOOLTIPANIMATION
  • SPI_SETTOOLTIPFADE
  • SPI_SETUIEFFECTS
  • SPI_GETACTIVEWINDOWTRACKING
  • SPI_GETACTIVEWNDTRKZORDER
  • SPI_GETACTIVEWNDTRKTIMEOUT
  • SPI_GETANIMATION
  • SPI_GETBORDER
  • SPI_GETCARETWIDTH
  • SPI_GETDRAGFULLWINDOWS
  • SPI_GETFOREGROUNDFLASHCOUNT
  • SPI_GETFOREGROUNDLOCKTIMEOUT
  • SPI_GETMINIMIZEDMETRICS
  • SPI_GETNONCLIENTMETRICS
  • SPI_GETSHOWIMEUI
  • SPI_SETACTIVEWINDOWTRACKING
  • SPI_SETACTIVEWNDTRKZORDER
  • SPI_SETACTIVEWNDTRKTIMEOUT
  • SPI_SETANIMATION
  • SPI_SETBORDER
  • SPI_SETCARETWIDTH
  • SPI_SETDRAGFULLWINDOWS
  • SPI_SETDRAGWIDTH
  • SPI_SETDRAGWIDTH
  • SPI_SETFOREGROUNDFLASHCOUNT
  • SPI_SETFOREGROUNDLOCKTIMEOUT
  • SPI_SETMINIMIZEDMETRICS
  • SPI_SETNONCLIENTMETRICS
  • SPI_SETSHOWIMEUI
  • SPI_GETWINDOWSEXTENSION
  • SPI_SETPENWINDOWS

Additional actions (zero for none):

  • SPIF_UPDATEINIFILE
  • SPIF_SENDCHANGE
  • SPIF_SENDWINDOWINICHANGE
False on failure. The parameter and action. Depends on uiAction. Depends on uiAction. Additional actions. Draws an string without formatting (single line). False on failure. The Device Context. The text origin in logical coordinates. The text origin in logical coordinates. The text. The number of (Wide)Chars in the string. Forces an immediate repaint of a window, if required. False on failure. The window handle. Finds the window containing the specified point. The window handle, zero on failure. The screen coordinates. Adds an event handler routine for the specified handle. Pointer to the event handler structure created in the widgetset class. Adds a process handler routine for the specified handle. Adds a pipe handler routine for the specified handle. Allocates an invisible window that can be used to receive messages. The window handle, zero on failure. The callback method for the window. Can be Nil. Displays a dialog box with the specified values, and returns the modal result.

AskUser uses the native facilities provided by the platform or operating system to display a dialog, and captures the modal result value. This method is overridden in descendent class to implement the platform-specific dialog.

The implementation in TWidgetSet is used as a fallback when no other mechanism is available. It uses the routine assigned to QuestionDialogFunction to execute the dialog and capture the modal result value. No default actions are peformed when QuestionDialogFunction has not been assigned (contains Nil).

Modal result value for the dialog as a LongInt type. Caption for the dialog. Message text for the dialog. Dialog type used to get an icon and flags used the dialog. Collection with buttons for the dialog. Help context used when F1 is pressed in the dialog. Calls the default window handler to process a message from a control. The control posting the message. Message structure with the command and parameters. Gets the MIME type for the specified clipboard format. TClipboardFormat MIME type for the clipboard format identifier. Identifier for the registered clipboard format. Gets clipboard data for a given format and saves it to the specified stream. True if clipboard data was successfully retrieved and stored in the method. The clipboard operation type. Identifier for the registered clipboard format. Stream where the clipboard data is appended. Gets a list of available registered clipboard formats. True on success. The clipboard operation type. Number of clipboard formats returned in the list. Pointer to the list of available registered clipboard formats. Sets the requested formats and requests ownership of the clipboard. True on success. Type of clipboard type for the request. Event signalled to get data for the clipboard, or Nil when ownership is lost. Number of clipbpard formats in the list. Pointer to the list of registered clipboard formats requested. Registers a clipboard format for the specified MIME type. Pointer to the unsigned Integer value for the clipboard format. MIME type for the clipboard data. Creates one of the standard cursors. TCursor The cursor handle, zero on failure. The cursor shape. Deletes a window created with AllocateHWnd. The window handle. Draws the DockRect during drag-dock operations. The Windows implementation doesn't cooperate with the DragManager. See Mantis 0018525. The old DockRect. The new DockRect. Draws a grid lines inside a rectangle with the specified spacing. Draws an UTF-8 string without formatting (single line).

The inter-character spacing array (Dx) must have one element for every Char (byte) in the UTF-8 text. For multi-byte character codes the values of all Dx elements are summed up.

False on failure. The Device Context. The reference point, used to position the text. The reference point, used to position the text. Output options. The bounding rectangle. The text. The number of Chars in the string. Pointer to an array of inter-character spacing values, can be Nil. Determines if the typeface in the specified font handle is a mono-spaced font. Font handle examined in the method. Draws a 3D frame for a rectangle on a device context using the specified style. Gets a string representing the specified key and shift modifier. TNativeCanvasType TNativeCanvasTypes TNativeHandleType TNativeHandleTypes Gets the coordinates for the client area in the specified window handle. Updates the constraints object (e.g. TSizeConstraints) with interface specific bounds. False on failure. Should be a TSizeConstraints. Writes UTF-8-encoded text to the specified device context. Theme services class instance for the widgetset.

ThemeServices is a read-only property which provides access to the TThemeServices class instance for the platform. The value for the property is assigned in the CreateThemeServices method.

TThemeServices
Class reference used to create new instance of the TWidgetSet class. Constant used in TWidgetSet.GetLCLCapability. Constant used in TWidgetSet.GetLCLCapability. Base class for exceptions raised in the LCL interface. Exception raised in the LCL interface. Exception raised in the LCL interface. Exception raised in the LCL interface. Provides access to the widgetset class instance for the platform.

WidgetSet is a unit global TWidgetSet variable with the singleton used to access the widgetset class instance for the platform. WidgetSet contains a TWidgetSet descendant which implements the properties, methods, and events for a specific platform.