Function Reference


_GUICtrlToolbar_InsertButton

Inserts a button

#include <GuiToolbar.au3>
_GUICtrlToolbar_InsertButton ( $hWnd, $iIndex, $iID, $iImage [, $sText = "" [, $iStyle = 0 [, $iState = 4 [, $iParam = 0]]]] )

Parameters

$hWnd Handle to the control
$iIndex 0-based index of a button
$iID Command ID
$iImage 0-based image index
$sText [optional] Button text
$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
    $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

Return Value

Success: True.
Failure: False.

Remarks

Inserts the new button to the left of the button at $iIndex

Related

_GUICtrlToolbar_AddButton

Example

#include <GUIConstantsEx.au3>
#include <GuiToolbar.au3>
#include <WindowsConstants.au3>

Example()

Func Example()
    Local $hGUI, $hToolbar
    Local Enum $e_idNew = 1000, $e_idOpen, $e_idSave, $idHelp

    ; Create GUI
    $hGUI = GUICreate("Toolbar", 400, 300)
    $hToolbar = _GUICtrlToolbar_Create($hGUI)
    GUISetState(@SW_SHOW)

    ; Add standard system bitmaps
    _GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)

    ; Add buttons
    _GUICtrlToolbar_InsertButton($hToolbar, 0, $e_idNew, $STD_FILENEW)
    _GUICtrlToolbar_InsertButton($hToolbar, 1, $e_idOpen, $STD_FILEOPEN)
    _GUICtrlToolbar_InsertButton($hToolbar, 2, $e_idSave, $STD_FILESAVE)
    _GUICtrlToolbar_AddButtonSep($hToolbar)
    _GUICtrlToolbar_InsertButton($hToolbar, 4, $idHelp, $STD_HELP)

    ; Loop until the user exits.
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc   ;==>Example