Static – Giavapps Windows API

 

 

api_static_create(ParentHandle, X, Y, W, H, Flags, ExFlags) This function creates a static control.

ParentHandle: parent handle.
X: x coordinate.
Y: y coordinate.
W: width.
H: height.
Flags: Flags of the control. Flags must be separated with the symbol "|".
ExFlags: extended flags of the control. Flags must be separated with the symbol "|".

 

Flags

 

This control supports the Window Styles and you can specify any of the styles listed below:

 

SS_BITMAP A bitmap is to be displayed in the static control. The style ignores the W and H parameters; the control automatically sizes itself to accommodate the bitmap.

SS_BLACKFRAME 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 A rectangle filled with the current window frame color. This color is black in the default color scheme.

SS_CENTER 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 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. As of 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 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 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. Using this style will force the control’s text to be on one line with no word wrap. Compare with SS_PATHELLIPSIS and SS_WORDELLIPSIS.

SS_ENHMETAFILE An enhanced metafile is to be displayed in the static control. The text is the name of a metafile. An enhanced metafile static control has a fixed size; the metafile is scaled to fit the static control’s client area.

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 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 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. The icon can be an animated cursor. The style ignores the api_static_create() parameters W and H; the control automatically sizes itself to accommodate the icon.

SS_LEFT 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 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 to the parent window notification messages when the user clicks or double-clicks the control. This stile is required for using api_static_get_clicked() or api_static_get_doubleclicked() functions.

SS_OWNERDRAW he owner of the static control is responsible for drawing the control.

SS_PATHELLIPSIS 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. Using this style will force the control’s text to be on one line with no word wrap. Compare with SS_ENDELLIPSIS and SS_WORDELLIPSIS.

SS_REALSIZEIMAGE Specifies that the actual resource width is used. SS_REALSIZEIMAGE is always used in conjunction with SS_ICON. The static control is resized accordingly, but the icon remains aligned to the originally specified left and top edges of the control. Note that if SS_CENTERIMAGE is also specified, the icon is centered within the control’s space, which was specified using the api_static_create() parameters W and H.

SS_RIGHT 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 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 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 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 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 A rectangle filled with the current window background color. This color is white in the default color scheme.

SS_WORDELLIPSIS Truncates any word that does not fit in the rectangle and adds ellipses. Using this style will force the control’s text to be on one line with no word wrap. Compare with SS_ENDELLIPSIS and SS_PATHELLIPSIS.

 

Extended Flags

 

This control supports the Extended Window Styles.

 

Return Value

 

If the function succeeds, the return value is a handle to the new static control.

If the function fails, the return value is false.

To get extended error information, call api_control_get_last_error().

 

Control Functions

 

api_static_set_bitmap(StaticHandle, BitmapHandle) Sets a bitmap to a static control. The return value is the BitmapHandle previously associated with the static control, if any; otherwise, it is false. The specified static control must have SS_BITMAP style otherwise this function will fail.

StaticHandle: it must be a StaticHandle.
BitmapHandle: it must be a BitmapHandle.

 

api_static_get_bitmap(StaticHandle) This function returns the BitmapHandle associated with a static control, if any: otherwise the return value is false. The specified static control must have SS_BITMAP style otherwise this function will fail.

StaticHandle: it must be a StaticHandle.

 

api_static_set_cursor(StaticHandle, CursorHandle) Sets an icon to a static control. The return value is the CursorHandle previously associated with the static control, if any; otherwise, it is false. The specified static control must have SS_ICON style otherwise this function will fail.

StaticHandle: it must be a StaticHandle.
CursorHandle: it must be a CursorHandle.

 

api_static_get_cursor(StaticHandle) This function returns the CursorHandle associated with a static control, if any: otherwise the return value is false. The specified static control must have SS_ICON style otherwise this function will fail.

StaticHandle: it must be a StaticHandle.

 

api_static_set_icon(StaticHandle, IconHandle) Sets an icon to a static control. The return value is the IconHandle previously associated with the static control, if any; otherwise, it is false. The specified static control must have SS_ICON style otherwise this function will fail.

StaticHandle: it must be a StaticHandle.
IconHandle: it must be an IconHandle.

 

api_static_get_icon(StaticHandle) This function returns the IconHandle associated with a static control, if any: otherwise the return value is false. The specified StaticHandle must have SS_ICON style otherwise this function will fail.

StaticHandle: it must be a StaticHandle.

 

api_static_get_clicked(StaticHandle) This function returns true when the user clicks on the given static control or false otherwise. The specified StaticHandle must have SS_NOTIFY style otherwise this function will return always false.

StaticHandle: it must be a StaticHandle.

 

api_static_get_doubleclicked(StaticHandle) This function returns true when the user double clicks on the given static control or false otherwise. The specified StaticHandle must have SS_NOTIFY style otherwise this function will return always false.

StaticHandle: it must be a StaticHandle.

 

Code Examples

 

Creating a Static Control

 

static = api_static_create(window,10,10,32,32,WS_VISIBLE | WS_CHILD | SS_ICON | SS_NOTIFY,0);

 

Assigning an Icon to a Static Control

 

icon = api_icon_add("myicon.ico");
api_static_set_icon(static,icon);

 

Checking if the User clicks on a Static Control

 

if(api_static_get_clicked(static))
{
api_messagebox(window,"Clicked!","Message:",MB_OK);
}

 

I am Luigi Piscopo, also known as DJ GiDeejay / Producer / Remixer in the music world. I am a Producer with a lot of experience in photo editing, video editing, audio editing, graphic design, web design, programming and promotion.

Leave a Reply

Il tuo indirizzo email non sarà pubblicato. I campi obbligatori sono contrassegnati *

*