Function Reference

GUICtrlCreateButton

Creates a Button control for the GUI.

GUICtrlCreateButton ( "text", left, top [, width [, height [, style [, exStyle]]]] )

 

Parameters

text The text of the button control.
left The left side of the control. If -1 is used then left will be computed according to GUICoordMode.
top The top of the control. If -1 is used then top will be computed according to GUICoordMode.
width [optional] The width of the control (default is the previously used width).
height [optional] The height of the control (default is the previously used height).
style [optional] Defines the style of the control. See GUI Control Styles Appendix.

default ( -1) : none.
forced styles : $WS_TABSTOP, $BS_PUSHBUTTON, $BS_NOTIFY
exStyle [optional] Defines the extended style of the control. See Extended Style Table.

 

Return Value

Success: Returns the identifier (controlID) of the new control.
Failure: Returns 0.

 

Remarks

To set or change information in the control see GUICtrlSet....

A Button control can display an icon or image by using the $BS_ICON or $BS_BITMAP style. Use GUICtrlSetImage to specify the picture to use.

To add styles to default style just BitOr($GUI_SS_DEFAULT_BUTTON, newstyle,...).

 

Related

GUICoordMode (Option), GUICtrlSet..., GUIGetMsg

 

Example


#include <GUIConstants.au3>

GUICreate("My GUI Button")  ; will create a dialog box that when displayed is centered

Opt("GUICoordMode",2)
GUICtrlCreateButton ("OK",  10, 30, 50)
GUICtrlCreateButton ( "Cancel",  0, -1)

GUISetState ()       ; will display an  dialog box with 2 button

; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()
   
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
Wend