Purpose |
Add a stretched image button to a dialog. Stretched image buttons are often used to enhance the appearance of a dialog, with the image being automatically stretched or condensed to fill the control. | ||||||||||||
Syntax |
CONTROL ADD IMGBUTTONX, hDlg, id&, image$, x, y, xx, yy [, [style&] [, [exstyle&]]] [[,] CALL callback] | ||||||||||||
hDlg |
Handle of the dialog in which the button will be created. The dialog will become the parent of the control. | ||||||||||||
id& |
Unique identifier for the button in the range 1 to 65535, frequently specified with numeric equates for clarity of the code. For example, the equate %IconButton2 is more informative than a literal value such as 497. Best practice suggests identifiers should start at 100 to avoid conflict with any of the standard predefined identifiers. However, it is typical for a dialog to include an OK and/or a Cancel button, represented by the predefined equates %IDOK and %IDCANCEL respectively. A button with an ID of %IDOK is triggered (clicked) when the ENTER key is pressed by the user, and a button with the ID of %IDCANCEL is triggered when the ESCAPE key is pressed. These and other predefined "standard" equates can be found in the WIN32API.INC and DDT.INC files. | ||||||||||||
image$ |
Name of the bitmap or icon in the resource file. If the image resource uses an integral identifier, image$ should begin with a Number symbol (#) followed by the identifier in an ASCII format, e.g., "#998". Otherwise, use the text identifier name for the image. | ||||||||||||
x, y |
| ||||||||||||
xx |
Integral expression, variable, or numeric literal value, specifying the width of the control. The width is given in the same terms (pixels or dialog units) as the parent dialog. The most common value used in the Microsoft Dialog Editor and Visual Studio is 40 dialog units. | ||||||||||||
yy |
Integral expression, variable, or numeric literal value, specifying the height of the control. The height is given in the same terms (pixels or dialog units) as the parent dialog. The most common value used in the Microsoft Dialog Editor and Visual Studio is 14 dialog units. | ||||||||||||
style& |
Primary style of the stretched image button. The default image button style is %WS_TABSTOP. The default style is used if both the primary and extended style parameters are omitted from the statement. For example: CONTROL ADD IMGBUTTONX, hDlg, id&, txt$, 100, 100, 150, 200, , , _ CALL ImgButtonxCallback() ' Use default styles Custom style values replace the default values. That is, they are not additional to the default style values - your code must specify all necessary primary and extended style parameters. The primary stretched image button style value can be a combination of any values below, combined together with the OR operator to form a bitmask:
| ||||||||||||
exstyle& |
Extended style of the stretched image button control. The default extended button style comprises %WS_EX_LEFT. The default extended style is used if both the primary and extended parameters are omitted from the CONTROL ADD IMGBUTTONX statement, in the same manner as style& above. The extended stretched image style value can be a combination of any values below, combined together with the OR operator to form a bitmask:
| ||||||||||||
callback |
Optional name of a Callback Function that receives all %WM_COMMAND and %WM_NOTIFY messages for the control. See the #MESSAGES metastatement to choose which messages will be received. If a callback for the control is not designated, you must create a dialog Callback Function to process messages from your control. If the Callback Function processes a message, it should return TRUE (non-zero) to prevent the message being passed unnecessarily to the dialog callback (if one exists). The dialog callback should also return TRUE if the notification message is processed by that Callback Function. Otherwise, the DDT engine processes unhandled messages. | ||||||||||||
Remarks |
The bitmap or icon used in the button is resized to fit the button. If your button is 64 dialog units wide and your icon or bitmap is only 32, it will be stretched to cover the entire button. For best results, icons should be 32x32 pixels. The image button is drawn on the dialog using a 3-dimensional look, unless the %BS_FLAT style is specified. When the user clicks a button, a message is sent to the Callback Function designated for the button. If there is no Callback Function designated, the message is sent to the callback for the dialog. Notification messages are sent to the Callback Function with CB.MSG = %WM_COMMAND, CB.CTL holding the ID (id&) of the control, and CB.CTLMSG holding the following values:
When a Callback Function receives a %WM_COMMAND message, it should explicitly test the value of CB.CTL and CB.CTLMSG to guarantee it is responding appropriately to the notification message. | ||||||||||||
See also |
Dynamic Dialog Tools, CONTROL ADD GRAPHIC, CONTROL ADD IMAGE, CONTROL ADD IMAGEX, CONTROL ADD IMGBUTTON, CONTROL SET IMAGE, CONTROL SET IMAGEX, CONTROL SET IMGBUTTON, CONTROL SET IMGBUTTONX |