Chimaera Posted April 2, 2015 Share Posted April 2, 2015 On a GUI im doing im becoming concerned about the amount of buttons and radios im adding affecting load times etc Of these 2 example options which is the better way or is there no difference? So this one where i hold the icon creation until the reg key has been checked ; ####################################################################### GUICtrlCreateLabel('Battery Check / Advise', 50, 227, 170, 25) _Font() GUIStartGroup() Local $T3BatteryRadio1 = GUICtrlCreateRadio('Pass', 240, 224, 64, 23) _NoTheme($T3BatteryRadio1) Local $T3BatteryRadio2 = GUICtrlCreateRadio('Fail', 300, 224, 64, 23) _NoTheme($T3BatteryRadio2) Local $T3BatteryRegCheck = RegRead('HKEY_LOCAL_MACHINE\SYSTEM\Setup\Simple\Service', 'Battery'),$T3BatteryIcon If $T3BatteryRegCheck = '' Then $T3BatteryIcon = GUICtrlCreateIcon($cross, -1, 22, 226, 20, 20) ElseIf $T3BatteryRegCheck = 'NotCompleted' Then $T3BatteryIcon = GUICtrlCreateIcon($cross, -1, 22, 226, 20, 20) GUICtrlSetState($T3BatteryRadio2, $GUI_CHECKED) Else $T3BatteryIcon = GUICtrlCreateIcon($tick, -1, 22, 226, 20, 20) GUICtrlSetState($T3BatteryRadio1, $GUI_CHECKED) EndIf Local $T3BatteryGroup = GUICtrlCreateGroup('', 15, 214, 350, 38) DllCall('UxTheme.dll', 'int', 'SetWindowTheme', 'hwnd', GUICtrlGetHandle($T3BatteryGroup), 'wstr', 0, 'wstr', 0) ; ####################################################################### Or this one where i pre declare the icon and create it, then just set the image ; ####################################################################### GUICtrlCreateLabel('Battery Check / Advise', 50, 227, 170, 25) _Font() Local $T3BatteryIcon = GUICtrlCreateIcon($cross, -1, 22, 226, 20, 20) GUIStartGroup() Local $T3BatteryRadio1 = GUICtrlCreateRadio('Pass', 240, 224, 64, 23) _NoTheme($T3BatteryRadio1) Local $T3BatteryRadio2 = GUICtrlCreateRadio('Fail', 300, 224, 64, 23) _NoTheme($T3BatteryRadio2) Local $T3BatteryRegCheck = RegRead('HKEY_LOCAL_MACHINE\SYSTEM\Setup\Simple\Service', 'Battery'),$T3BatteryIcon If $T3BatteryRegCheck = '' Then GUICtrlSetImage($T3BatteryIcon, $cross) ElseIf $T3BatteryRegCheck = 'NotCompleted' Then GUICtrlSetImage($T3BatteryIcon, $cross) GUICtrlSetState($T3BatteryRadio2, $GUI_CHECKED) Else GUICtrlSetImage($T3BatteryIcon, $tick) GUICtrlSetState($T3BatteryRadio1, $GUI_CHECKED) EndIf Local $T3BatteryGroup = GUICtrlCreateGroup('', 15, 214, 350, 38) DllCall('UxTheme.dll', 'int', 'SetWindowTheme', 'hwnd', GUICtrlGetHandle($T3BatteryGroup), 'wstr', 0, 'wstr', 0) ; ####################################################################### Its purely that i have a lot of these and i want to slow the gui down as little as possible over a couple of hundred of these If Ive just helped you ... miracles do happen. Chimaera CopyRobo() * Hidden Admin Account Enabler * Software Location From Registry * Find Display Resolution * _ChangeServices() Link to comment Share on other sites More sharing options...
Chimaera Posted April 3, 2015 Author Share Posted April 3, 2015 Ok ill rephrase then Should i hide the icon within the if/endif structure and declare when needed or Should i declare the icon first so the gui can load it properly then apply changes when needed which method incurs the least cost in mem/cpu usage If Ive just helped you ... miracles do happen. Chimaera CopyRobo() * Hidden Admin Account Enabler * Software Location From Registry * Find Display Resolution * _ChangeServices() Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now