Search the Community
Showing results for tags 'round'.
-
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:
-
Hello everybody! I'm having trouble with rounding. The program I'm using rounds decimals down. Autoit's round function rounds them up. Example: round(174.126, 2) = 174.13 I need that round to be 174.12. Here's the actually script: #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form=C:Program FilesAutoinstallForm1.kxf $Form1 = GUICreate("AutoCalc", 227, 200, 15, 15, $WS_EX_TOPMOST) $Button1 = GUICtrlCreateButton("Calculate", 8, 144, 99, 25) $Button2 = GUICtrlCreateButton("Close", 120, 144, 91, 25) $Label4 = GUICtrlCreateLabel("", 72, 136, 4, 4) GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif") $Group1 = GUICtrlCreateGroup("Input", 8, 8, 209, 129) $Label1 = GUICtrlCreateLabel("Rate", 16, 32, 27, 17) $Label2 = GUICtrlCreateLabel("Number of Nights", 16, 64, 86, 17) $Input1 = GUICtrlCreateInput("0.00", 112, 24, 89, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_RIGHT)) $Label3 = GUICtrlCreateLabel("Total", 16, 96, 45, 28) GUICtrlSetFont(-1, 11, 400, 0, "MS Sans Serif") $Input2 = GUICtrlCreateInput("1", 112, 56, 89, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_RIGHT)) ;$Label5 = GUICtrlCreateLabel("0.00", 136, 96, 39, 28) GUICtrlSetFont(-1, 11, 400, 0, "MS Sans Serif") GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit case $Button1 ;$val = round((((((GUICtrlRead($input1) * .1545) + GUICtrlRead($input1)) + 1.5 + .13) * GUICtrlRead($input2))), 2) $val = (((((GUICtrlRead($input1) * .1545) + GUICtrlRead($input1)) + 1.5 + .13) * GUICtrlRead($input2))) $Label5 = GUICtrlCreateLabel($val, 136, 96, 39, 28) case $Button2 Exit EndSwitch WEnd