Adds a button
#include <GuiToolbar.au3>
_GUICtrlToolbar_AddButton ( $hWnd, $iID, $iImage [, $iString = 0 [, $iStyle = 0 [, $iState = 4 [, $iParam = 0]]]] )
$hWnd | Handle to the control |
$iID | Command ID |
$iImage | 0-based index of the button image. Set this parameter to -1 and the control will send the $TBN_GETDISPINFO notification to retrieve the image index when it is needed. Set this to -2 to indicate that the button does not have an image. The button layout will only include space for the text. If the button is a separator, this is the width of the separator, in pixels. |
$iString | [optional] 0-based index of the button string that was set with AddString |
$iStyle | [optional] Button style. Can be a combination of the following: $BTNS_AUTOSIZE - The toolbar control should not assign the standard width to the button $BTNS_BUTTON - Standard button (Default) $BTNS_CHECK - Toggles between the pressed and nonpressed $BTNS_CHECKGROUP - Button that stays pressed until another button in the group is pressed $BTNS_DROPDOWN - Creates a drop-down style button that can display a list $BTNS_GROUP - Button that stays pressed until another button in the group is pressed $BTNS_NOPREFIX - The button text will not have an accelerator prefix $BTNS_SEP - Creates a separator $BTNS_SHOWTEXT - Specifies that button text should be displayed $BTNS_WHOLEDROPDOWN - Specifies that the button will have a drop-down arrow |
$iState | [optional] Button state. Can be a combination of the following: $TBSTATE_CHECKED - The button has the $TBSTYLE_CHECK style and is being clicked $TBSTATE_PRESSED - The button is being clicked $TBSTATE_ENABLED - The button accepts user input $TBSTATE_HIDDEN - The button is not visible and cannot receive user input $TBSTATE_INDETERMINATE - The button is grayed $TBSTATE_WRAP - The button is followed by a line break $TBSTATE_ELLIPSES - The button's text is cut off and an ellipsis is displayed $TBSTATE_MARKED - The button is marked |
$iParam | [optional] Application-defined value |
Success: | True. |
Failure: | False. |
_GUICtrlToolbar_DeleteButton, _GUICtrlToolbar_InsertButton
#include <GUIConstantsEx.au3>
#include <GuiToolbar.au3>
#include <WinAPIConstants.au3>
#include <WindowsConstants.au3>
Example()
Func Example()
; Create GUI
Local $hGUI = GUICreate("Toolbar Add Bitmao (v" & @AutoItVersion & ")", 400, 300)
Local $hToolbar = _GUICtrlToolbar_Create($hGUI)
GUISetState(@SW_SHOW)
; Set ANSI format
;~ _GUICtrlToolbar_SetUnicodeFormat($hToolbar, False)
; Add standard system bitmaps
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
; Add buttons
Local Enum $e_idNew = 1000, $e_idOpen, $e_idSave, $idHelp
_GUICtrlToolbar_AddButton($hToolbar, $e_idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $e_idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $e_idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)
; Loop until the user exits.
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>Example