Static control help

Function help:

Real API_Static_Create (Real Parent Handle, Real X, Real Y, Real Width, Real Height, Real Style Flags, Real Extended Style Flags);

This function creates a new static control.

Argument list:
(0) Parent Handle: Identifies the window handle of the window to create this control on.
(1) X: The horizontal position of the control in pixels, relative to the parent window.
(2) Y: The vertical position of the control in pixels, relative to the parent window.
(3) Width: The horizontal size of the control in pixels.
(4) Height: The vertical size of the control in pixels.
(5) Style Flags: The style flags, supports the Global Control Styles and the following styles:

SS_BITMAP
Specifies that a bitmap is to be displayed in the static control.
SS_BLACKFRAME
Specifies a box with a frame drawn in the same color as the window frames. This color is black in the default color scheme.
SS_BLACKRECT
Specifies a rectangle filled with the current window frame color. This color is black in the default color scheme.
SS_CENTER
Specifies a simple rectangle and centers the text in the rectangle. The text is formatted before it is displayed. Words that extend past the end of a line are automatically wrapped to the beginning of the next centered line. Words that are longer than the width of the control are truncated.
SS_CENTERIMAGE
Specifies that a bitmap is centered in the static control that contains it. The control is not resized, so that a bitmap too large for the control will be clipped. If the static control contains a single line of text, the text is centered vertically in the client area of the control.

Microsoft Windows XP: This style bit no longer results in unused portions of the control being filled with the color of the top left pixel of the bitmap or icon. Unused portions of the control will remain the background color.
SS_EDITCONTROL
Windows 2000: Specifies that the static control duplicates the text-displaying characteristics of a multiline edit control. Specifically, the average character width is calculated in the same manner as with an edit control, and the function does not display a partially visible last line.
SS_ENDELLIPSIS
Microsoft Windows NT or later: If the end of a string does not fit in the rectangle, it is truncated and ellipses are added. If a word that is not at the end of the string goes beyond the limits of the rectangle, it is truncated without ellipses. Compare with SS_PATHELLIPSIS and SS_WORDELLIPSIS.
SS_ETCHEDFRAME
Draws the frame of the static control using the EDGE_ETCHED edge style.
SS_ETCHEDHORZ
Draws the top and bottom edges of the static control using the EDGE_ETCHED edge style.
SS_ETCHEDVERT
Draws the left and right edges of the static control using the EDGE_ETCHED edge style.
SS_GRAYFRAME
Specifies a box with a frame drawn with the same color as the screen background (desktop). This color is gray in the default color scheme.
SS_GRAYRECT
Specifies a rectangle filled with the current screen background color. This color is gray in the default color scheme.
SS_ICON
Specifies an icon to be displayed in the dialog box.
SS_LEFT
Specifies a simple rectangle and left-aligns the text in the rectangle. The text is formatted before it is displayed. Words that extend past the end of a line are automatically wrapped to the beginning of the next left-aligned line. Words that are longer than the width of the control are truncated.
SS_LEFTNOWORDWRAP
Specifies a simple rectangle and left-aligns the text in the rectangle. Tabs are expanded, but words are not wrapped. Text that extends past the end of a line is clipped.
SS_NOPREFIX
Prevents interpretation of any ampersand (&) characters in the control's text as accelerator prefix characters. These are displayed with the ampersand removed and the next character in the string underlined. This static control style may be included with any of the defined static controls. You can combine SS_NOPREFIX with other styles. This can be useful when filenames or other strings that may contain an ampersand (&) must be displayed in a static control in a dialog box.
SS_NOTIFY
Sends the parent window STN_CLICKED, STN_DBLCLK, STN_DISABLE, and STN_ENABLE notification messages when the user clicks or double-clicks the control.
SS_PATHELLIPSIS
Windows NT or later: Replaces characters in the middle of the string with ellipses so that the result fits in the specified rectangle. If the string contains backslash (\) characters, SS_PATHELLIPSIS preserves as much as possible of the text after the last backslash. Compare with SS_ENDELLIPSIS and SS_WORDELLIPSIS.
SS_REALSIZECONTROL
Windows XP or later: Adjusts the bitmap to fit the size of the static control. For example, changing the locale can change the system font, and thus controls might be resized. If a static control had a bitmap, the bitmap would no longer fit the control. This style bit dictates automatic redimensioning of bitmaps to fit their controls.
SS_RIGHT
Specifies a simple rectangle and right-aligns the text in the rectangle. The text is formatted before it is displayed. Words that extend past the end of a line are automatically wrapped to the beginning of the next right-aligned line. Words that are longer than the width of the control are truncated.
SS_RIGHTJUST
Specifies that the lower right corner of a static control with the SS_BITMAP or SS_ICON style is to remain fixed when the control is resized. Only the top and left sides are adjusted to accommodate a new bitmap or icon.
SS_SIMPLE
Specifies a simple rectangle and displays a single line of left-aligned text in the rectangle. The text line cannot be shortened or altered in any way. Also, if the control is disabled, the control does not gray its text.
SS_SUNKEN
Draws a half-sunken border around a static control.
SS_TYPEMASK
Windows 2000: A composite style bit that results from using the OR operator on SS_* style bits. Can be used to mask out valid SS_* bits from a given bitmask. Note that this is out of date and does not correctly include all valid styles. Thus, you should not use this style.
SS_WHITEFRAME
Specifies a box with a frame drawn with the same color as the window background. This color is white in the default color scheme.
SS_WHITERECT
Specifies a rectangle filled with the current window background color. This color is white in the default color scheme.
SS_WORDELLIPSIS
Windows NT or later: Truncates any word that does not fit in the rectangle and adds ellipses.

Compare with SS_ENDELLIPSIS and SS_PATHELLIPSIS.

Style flags can be separated by a bitwise or '|' operator.

(6) Extended Style Flags: This can be any combination of the Global Extended Control Styles.

Return value:
If this function succeeds, it returns the Control ID of the control, otherwise it returns 0.


Real API_Static_GetIcon ( Real Control ID)

This function returns the icon resource handle of the icon assigned to the static control.

Return value:
Returns the icon resource handle.

Real API_Static_GetImage ( Real Control ID, Real Image Type)

This function returns the image resource handle of the image assigned to the static control.

You can use the following image types:
0 - A bitmap
1 - A cursor
2 - An icon

Return value:
Returns the image resource handle.
Real API_Static_SetIcon ( Real Control ID, Real Icon Resource Handle)

This function changes the icon assigned to the static control.

You can use the following image types:
0 - A bitmap
1 - A cursor
2 - An icon

Return value:
The return value is a handle to the icon previously associated with the icon control, or zero if an error occurs.
Real API_Static_SetImage ( Real Control ID, Real Image Type, Real Image Resource Handle)

This function changes the image assigned to the static control.

You can use the following image types:
0 - A bitmap
1 - A cursor
2 - An icon

See the API_Resource_LoadIcon, API_Resource_LoadBitmap and API_Resource_LoadCursor functions.

Return value:
The return value is a handle to the image previously associated with the static control, if any; otherwise, it is 0.

Secondary check commands for static controls:

STN_CLICKED - The user clicks a static control that has the SS_NOTIFY style.
STN_DBLCLK - The user double clicks a static control that has the SS_NOTIFY style.

Example:

Command = API_Check_Command (1); // Check commands for check handle 1

if ( Command == Static1 ) // Static1 sends a command
{
Second = API_Check_SecondaryCommand (1); // Check the command type

if ( Second == STN_DBLCLK) // The control is double clicked
{
show_message ("The control is double clicked.");
}

}



Example code:

is
Static1 = API_Static_Create (Win,450,50,100,20,SS_BITMAP|SS_NOTIFY);
Bitmap1 = API_Resource_LoadBitmap ("mwa.bmp"); // Load wma.bmp into a bitmap resource handle
API_Static_SetImage (Static1,0,Bitmap1); // Set the image

Return to help index