WinXAddStatic


hStatic = WinXAddStatic (parent, STRING title, hImage, style, id)

Adds a new static (label) control to the specified window.

Parameter Description
parent  The window to add this control to
STRING title  The text to appear in the control, or if this control displays an image, "bitmap" or "icon" depending on what kind of handle is specified by hImage
hImage  The handle to the image to display in this static control, or 0 if this static control does not display an image
style  The window style for the static control. See the remarks section
id The unique id of the static control

Returns

A handle to the static control or 0 on fail.

Remarks

The style parameter takes a standard window style. Listed are some of more usefull constants. See the Win32 documentation for a complete list. These constants can be combine with the | (or) operator.

$$SS_BITMAP
This static control displays a bitmap image, the hImage parameter will be the handle to this bitmap and the title parameter will be "bitmap"
$$SS_ICON
This static control displays an icon, the hImage parameter will be the handle to this icon and the title parameter will be "icon"
$$SS_LEFT
The text is left justified in the control
$$SS_CENTER
The text is center justified in the control
$$SS_RIGHT
The text is right justified in the control

The size and position of the static control is set using either a custom control sizer function (controlSizer callback) or the auto sizer. To use the auto sizer, use the WinXAutoSizer_SetInfo function.

Examples

'define constants for the static controls
$$IDSTATIC1 = 100
$$IDSTATIC2 = 101

'make a button with text
hStatic1 = WinXAddStatic (#hMain, "Click me", 0, $$SS_LEFT, $$IDSTATIC1)

'make a button using an icon loaded from the resource file
hImage = LoadIconA (GetModuleHandleA (0), &"mainIcon")
hStatic2 = WinXAddStatic (#hMain, "icon", hImage, $$SS_ICON, $$IDSTATIC2)

Related Links

WinXAutoSizer_SetInfo
controlSizer (Callback)