Function Reference


_GUICtrlToolbar_SetDisabledImageList

Sets the disabled image list

#include <GuiToolbar.au3>
_GUICtrlToolbar_SetDisabledImageList ( $hWnd, $hImageList )

Parameters

$hWnd Handle to the control
$hImageList Handle to the image list that will be set

Return Value

Success: the handle to the image list previously used to display disabled buttons.
Failure: 0.

Related

_GUICtrlToolbar_GetDisabledImageList

Example

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

Global $g_idMemo

Example()

Func Example()
        ; Create GUI
        Local $hGUI = GUICreate("Toolbar Get/Set Disabled ImageList (v" & @AutoItVersion & ")", 420, 300)
        GUISetBkColor(0xffff00)
        Local $hToolbar = _GUICtrlToolbar_Create($hGUI)
        $g_idMemo = GUICtrlCreateEdit("", 2, 36, 416, 262, $WS_VSCROLL)
        GUICtrlSetFont($g_idMemo, 10, 400, 0, "Courier New")
        GUISetState(@SW_SHOW)

        ; Create normal image list
        Local $hNormal = _GUIImageList_Create(32, 24)
        _GUIImageList_Add($hNormal, _WinAPI_CreateSolidBitmap($hGUI, 0xFF0000, 32, 24))
        _GUIImageList_Add($hNormal, _WinAPI_CreateSolidBitmap($hGUI, 0x00FF00, 32, 24))
        _GUIImageList_Add($hNormal, _WinAPI_CreateSolidBitmap($hGUI, 0x0000FF, 32, 24))
        _GUICtrlToolbar_SetImageList($hToolbar, $hNormal)

        ; Create disabled image list
        Local $hDisabled = _GUIImageList_Create(32, 24)
        _GUIImageList_Add($hDisabled, _WinAPI_CreateSolidBitmap($hGUI, 0xCCCCCC, 32, 24))
        _GUIImageList_Add($hDisabled, _WinAPI_CreateSolidBitmap($hGUI, 0xCCCCCC, 32, 24))
        _GUIImageList_Add($hDisabled, _WinAPI_CreateSolidBitmap($hGUI, 0xCCCCCC, 32, 24))
        Local $hPrevImageList = _GUICtrlToolbar_SetDisabledImageList($hToolbar, $hDisabled)
        MemoWrite("Previous Disabled list handle .: 0x" & Hex($hPrevImageList))
        MemoWrite("IsPtr = " & IsPtr($hPrevImageList) & " IsHWnd = " & IsHWnd($hPrevImageList))

        ; Create hot image list
        Local $hHot = _GUIImageList_Create(32, 24)
        _GUIImageList_Add($hHot, _WinAPI_CreateSolidBitmap($hGUI, 0x111111, 32, 24))
        _GUIImageList_Add($hHot, _WinAPI_CreateSolidBitmap($hGUI, 0x888888, 32, 24))
        _GUIImageList_Add($hHot, _WinAPI_CreateSolidBitmap($hGUI, 0xAAAAAA, 32, 24))
        _GUICtrlToolbar_SetHotImageList($hToolbar, $hHot)

        ; Add buttons
        Local Enum $idRed = 1000, $idGreen, $idBlue
        _GUICtrlToolbar_AddButton($hToolbar, $idRed, 0)
        _GUICtrlToolbar_AddButton($hToolbar, $idGreen, 1)
        _GUICtrlToolbar_AddButton($hToolbar, $idBlue, 2)

        ; Disable Blue button
        _GUICtrlToolbar_EnableButton($hToolbar, $idBlue, False)

        ; Show image list handles
        MemoWrite("Disabled list handle .: 0x" & Hex(_GUICtrlToolbar_GetDisabledImageList($hToolbar)))
        MemoWrite("IsPtr = " & IsPtr(_GUICtrlToolbar_GetDisabledImageList($hToolbar)) & " IsHWnd = " & IsHWnd(_GUICtrlToolbar_GetDisabledImageList($hToolbar)))
        MemoWrite("Hot list handle ......: 0x" & Hex(_GUICtrlToolbar_GetHotImageList($hToolbar)))
        MemoWrite("Normal list handle ...: 0x" & Hex(_GUICtrlToolbar_GetImageList($hToolbar)))

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

; Write message to memo
Func MemoWrite($sMessage = "")
        GUICtrlSetData($g_idMemo, $sMessage & @CRLF, 1)
EndFunc   ;==>MemoWrite