; 2 Radio Groups, each with 2 entries... ; Group 1 works. ; Group 2 does not work correctly. ; =============================================================================================================================== ; Name ..........: MetroGUI UDF Example ; Version .......: v4.0.1 ; Author ........: BB_19 ; =============================================================================================================================== ;!Highly recommended for improved overall performance and responsiveness of the GUI effects etc.! (after compiling): #AutoIt3Wrapper_Run_Au3Stripper=y #Au3Stripper_Parameters=/so /rm /pe ;Required if you want High DPI scaling enabled. (Also requries _Metro_EnableHighDPIScaling()) ;#AutoIt3Wrapper_Res_HiDpi=y #NoTrayIcon #include "MetroGUI-UDF\MetroGUI_UDF.au3" ;=======================================================================Creating the GUI=============================================================================== ;Set Theme _SetTheme("DarkBlue") ;See MetroThemes.au3 for selectable themes or to add more ;Enable high DPI support: Detects the users DPI settings and resizes GUI and all controls to look perfectly sharp. _Metro_EnableHighDPIScaling() ; Note: Requries "#AutoIt3Wrapper_Res_HiDpi=y" for compiling. To see visible changes without compiling, you have to disable dpi scaling in compatibility settings of Autoit3.exe ;Create resizable Metro GUI $Form1 = _Metro_CreateGUI("Example", 500, 300, -1, -1, True) ;Set min size for the gui (optional/only for resize) _GUI_DragAndResizeUpdate($Form1, 500, 300) ;Add/create control buttons to the gui $Control_Buttons = _Metro_AddControlButtons(True, True, True, True, True) ;CloseBtn = True, MaximizeBtn = True, MinimizeBtn = True, FullscreenBtn = True, MenuBtn = True ;Set variables for the handles of the GUI-Control buttons. (Above function always returns an array this size and in this order, no matter which buttons are selected. $GUI_CLOSE_BUTTON = $Control_Buttons[0] $GUI_MAXIMIZE_BUTTON = $Control_Buttons[1] $GUI_RESTORE_BUTTON = $Control_Buttons[2] $GUI_MINIMIZE_BUTTON = $Control_Buttons[3] $GUI_FULLSCREEN_BUTTON = $Control_Buttons[4] $GUI_FSRestore_BUTTON = $Control_Buttons[5] $GUI_MENU_BUTTON = $Control_Buttons[6] ;====================================================================================================================================================================== ;Create Buttons $Button1 = _Metro_CreateButton("Button Style 1", 105, 240, 130, 40) ; 105 from left edge "Example" win, 240 from top edge ;$Button2 = _Metro_CreateButtonEx("Button Style 2", 255, 240, 130, 40) ;Create 2 Radios that are assigned to Radio Group 1 $rgrp_1 = 1 $Radio1 = _Metro_CreateRadio($rgrp_1, "Radio 1", 180, 70, 100, 30) $Radio2 = _Metro_CreateRadio($rgrp_1, "Radio 2", 180, 110, 100, 30) ;Create 2 Radios that are assigned to Radio Group 2 $rgrp_2 = 2 $Radio3 = _Metro_CreateRadio($rgrp_2, "Radio 3", 320, 70, 100, 30) $Radio4 = _Metro_CreateRadio($rgrp_2, "Radio 4", 320, 110, 100, 30) _Metro_RadioCheck($rgrp_1, $Radio1) ;check $Radio1 which is assigned to radio group "1" and uncheck any other radio in group "1" _Metro_RadioCheck($rgrp_2, $Radio3) ;Create Progressbar $Progress1 = _Metro_CreateProgress(100, 180, 300, 26) ;Create an Array containing menu button names Dim $MenuButtonsArray[4] = ["Settings", "About", "Contact", "Exit"] ;Set resizing options for the controls so they don't change in size or position. This can be customized to match your gui perfectly for resizing. See AutoIt Help file. GUICtrlSetResizing($Button1, 768 + 8) GUICtrlSetResizing($Radio1, 768 + 2 + 32) GUICtrlSetResizing($Radio2, 768 + 2 + 32) GUICtrlSetResizing($Radio3, 768 + 2 + 32) GUICtrlSetResizing($Radio4, 768 + 2 + 32) GUICtrlSetResizing($Progress1[0], 768 + 2 + 32) GUISetState(@SW_SHOW) While 1 _Metro_HoverCheck_Loop($Form1) ;This hover check has to be added to the main While loop, otherwise the hover effects won't work. $nMsg = GUIGetMsg() Switch $nMsg ;=========================================Control-Buttons=========================================== Case $GUI_EVENT_CLOSE, $GUI_CLOSE_BUTTON _Metro_GUIDelete($Form1) Exit Case $GUI_MAXIMIZE_BUTTON GUISetState(@SW_MAXIMIZE) Case $GUI_RESTORE_BUTTON GUISetState(@SW_RESTORE) Case $GUI_MINIMIZE_BUTTON GUISetState(@SW_MINIMIZE) Case $GUI_FULLSCREEN_BUTTON, $GUI_FSRestore_BUTTON _Metro_FullscreenToggle($Form1, $Control_Buttons) ;=================================================================================================== Case $GUI_MENU_BUTTON Local $MenuSelect = _Metro_MenuStart($Form1, $GUI_MENU_BUTTON, 150, $MenuButtonsArray) ; Opens the metro Menu. See decleration of $MenuButtonsArray above. Switch $MenuSelect ;Above function returns the index number of the button from the provided buttons array. Case "0" ConsoleWrite("Returned 0 = Settings button clicked." & @CRLF) Case "1" ConsoleWrite("Returned 1 = About button clicked." & @CRLF) Case "2" ConsoleWrite("Returned 2 = Contact button clicked." & @CRLF) Case "3" ConsoleWrite("Returned 3 = Exit button clicked." & @CRLF) Exit EndSwitch Case $Button1 Exit Case $Radio1 _Metro_RadioCheck($rgrp_1, $Radio1) ConsoleWrite("Radio 1 selected!" & _Metro_RadioIsChecked($rgrp_1, $Radio1) & @CRLF) Case $Radio2 _Metro_RadioCheck($rgrp_1, $Radio2) ConsoleWrite("Radio 2 selected = " & _Metro_RadioIsChecked($rgrp_1, $Radio2) & @CRLF) Case $Radio3 _Metro_RadioCheck($rgrp_2, $Radio3) ConsoleWrite("Radio 3 selected = " & _Metro_RadioIsChecked($rgrp_2, $Radio3) & @CRLF) Case $Radio4 _Metro_RadioCheck($rgrp_2, $Radio4) ConsoleWrite("Radio 4 selected = " & _Metro_RadioIsChecked($rgrp_2, $Radio4) & @CRLF) EndSwitch WEnd