Search the Community
Showing results for tags 'buttons icons'.
-
RoundButtons collection of round buttons ; https://www.autoitscript.com/forum/topic/211721-round-buttons/ ;---------------------------------------------------------------------------------------- ; Title...........: RoundButtons.au3 ; Description.....: collection of round buttons ; AutoIt Version..: 3.3.18.0 Author: ioa747 Script Version: 0.2 ; Note............: Testet in Windows 11 Pro 25H2 Date:1/8/2026 ;---------------------------------------------------------------------------------------- #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #include <GUIConstantsEx.au3> #include <StaticConstants.au3> Global $aBtn[7][2] Example() Func Example() Local $MyGui = GUICreate(" My GUI Icons", 300, 500) $aBtn[0][0] = 6 ; cnt of buttons $aBtn[0][1] = GUICtrlCreateDummy() $aBtn[1][1] = "red" $aBtn[1][0] = GUICtrlCreateIcon(@ScriptDir & "\Buttons\" & $aBtn[1][1] & "_normal.ico", 0, 20, 20, 64, 64, $SS_NOTIFY) $aBtn[2][1] = "yellow" $aBtn[2][0] = GUICtrlCreateIcon(@ScriptDir & "\Buttons\" & $aBtn[2][1] & "_normal.ico", 0, 20, 100, 64, 64, $SS_NOTIFY) $aBtn[3][1] = "green" $aBtn[3][0] = GUICtrlCreateIcon(@ScriptDir & "\Buttons\" & $aBtn[3][1] & "_normal.ico", 0, 20, 180, 64, 64, $SS_NOTIFY) $aBtn[4][1] = "turquoise" $aBtn[4][0] = GUICtrlCreateIcon(@ScriptDir & "\Buttons\" & $aBtn[4][1] & "_normal.ico", 0, 20, 260, 64, 64, $SS_NOTIFY) $aBtn[5][1] = "cyan" $aBtn[5][0] = GUICtrlCreateIcon(@ScriptDir & "\Buttons\" & $aBtn[5][1] & "_normal.ico", 0, 20, 340, 64, 64, $SS_NOTIFY) $aBtn[6][1] = "magenta" $aBtn[6][0] = GUICtrlCreateIcon(@ScriptDir & "\Buttons\" & $aBtn[6][1] & "_normal.ico", 0, 20, 420, 64, 64, $SS_NOTIFY) GUISetState(@SW_SHOW) Local $iMsg = 0 While 1 $iMsg = GUIGetMsg() Switch $iMsg Case $GUI_EVENT_CLOSE ExitLoop Case $aBtn[1][0] To $aBtn[6][0] ConsoleWrite("click=" & $iMsg & @CRLF) Case $aBtn[0][1] Local $iRBtn = GUICtrlRead($aBtn[0][1]) Local $sMsg = "??" Switch $iRBtn Case $aBtn[1][0] $sMsg = $aBtn[1][1] Case $aBtn[2][0] $sMsg = $aBtn[2][1] Case $aBtn[3][0] $sMsg = $aBtn[3][1] Case $aBtn[4][0] $sMsg = $aBtn[4][1] Case $aBtn[5][0] $sMsg = $aBtn[5][1] Case $aBtn[6][0] $sMsg = $aBtn[6][1] EndSwitch ConsoleWrite("-> " & $sMsg & @CRLF) EndSwitch _CheckAct($MyGui) WEnd GUIDelete() EndFunc ;==>Example Func _CheckAct($hGUI) Local Static $iLastBtnID = 0 Local $aCursor = GUIGetCursorInfo($hGUI) If Not WinActive($hGUI) Then Return If Not IsArray($aCursor) Then Return Local $iCurrentID = $aCursor[4] If $iCurrentID = $iLastBtnID Then ; Check if Mouse Down Local $bMouseDown = $aCursor[2] If $bMouseDown Then On_Act($iCurrentID, True, 2) While $bMouseDown $aCursor = GUIGetCursorInfo($hGUI) $bMouseDown = $aCursor[2] Sleep(10) WEnd On_Act($iCurrentID, False, 2) If $iCurrentID = $aCursor[4] Then GUICtrlSendToDummy($aBtn[0][1], $iCurrentID) EndIf EndIf Return EndIf ; Remove Hover ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ If $iLastBtnID <> 0 Then On_Act($iLastBtnID, False) $iLastBtnID = 0 EndIf ; Set Hover ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ If $iCurrentID <> 0 Then ; Check if it is an $mRoundBtn Local $idx = -1 For $i = 1 To $aBtn[0][0] If $aBtn[$i][0] = $iCurrentID Then $idx = $i ExitLoop EndIf Next If $idx > 0 Then On_Act($iCurrentID, True) $iLastBtnID = $iCurrentID EndIf EndIf EndFunc ;==>_CheckAct Func On_Act($idControl, $bHoover, $iFlag = 1) Local $idx, $sIcon Switch $iFlag Case 1 ; Hoover $idx = -1 For $i = 1 To $aBtn[0][0] If $aBtn[$i][0] = $idControl Then $idx = $i ExitLoop EndIf Next If $idx = -1 Then Return SetError(1, 0, -1) $sIcon = $aBtn[$idx][1] & ($bHoover ? "_hover.ico" : "_normal.ico") GUICtrlSetImage($idControl, @ScriptDir & "\Buttons\" & $sIcon) Case 2 ; Click $idx = -1 For $i = 1 To $aBtn[0][0] If $aBtn[$i][0] = $idControl Then $idx = $i ExitLoop EndIf Next If $idx = -1 Then Return SetError(1, 0, -1) $sIcon = $aBtn[$idx][1] & ($bHoover ? "_click.ico" : "_hover.ico") GUICtrlSetImage($idControl, @ScriptDir & "\Buttons\" & $sIcon) EndSwitch EndFunc ;==>On_Act Extract buttons folder in @ScriptDir Buttons.zip Please, every comment is appreciated! leave your comments and experiences here! Thank you very much
- 17 replies
-
- button
- buttoncolor
-
(and 2 more)
Tagged with:
-
$ActGroup2 = GUICtrlCreateGroup("Actions", 50, 360, 520, 50) $btnRefresh=GUICtrlCreateButton("Refresh",70,375,80,25) GUICtrlSetImage(-1,"shell32.dll",221,0) GUICtrlSetTip(-1,"Reset filter and refresh") $btnExport=GUICtrlCreateButton("Export",170,375,80,25,$BS_ICON) GUICtrlSetImage(-1,"C:\Program Files (x86)\Microsoft Office\Office14\EXCEL.EXE",1,0) GUICtrlSetTip(-1,"Export to Excel") $btnNew=GUICtrlCreateButton("New",270,375,80,25,$BS_ICON) GUICtrlSetImage(-1,"shell32.dll",1,0) GUICtrlSetTip(-1,"Create new RFC") $btnExit = GUICtrlCreateButton("Exit", 370, 375, 80, 25) GUICtrlSetImage(-1,"shell32.dll",329,0) $btnOpen = GUICtrlCreateButton("Open", 470, 375, 80, 25) GUICtrlSetImage(-1,"shell32.dll",290,0) GUICtrlCreateGroup("", -99, -99, 1, 1)Hi all In the following screen snap, you will notice that the second and third buttons do not have text, and yet in the code they clearly do. Does anyone know why this is so?