t1ck3ts Posted August 9, 2014 Share Posted August 9, 2014 Im trying to use GUICtrlSetImage inside a Do loop, problem is im not sure if i can use GUICtrlSetImage with an array inside the Do loop. Not sure if I'm doing this correctly. expandcollapse popupLocal $Sites[3][3] = [["Google" , "google.com" , "$Google"], _ ["Localhost" , "127.0.0.1" , "$localhost"], _ ["Google2" , "google.com" , "$Google2"]] $GUI = GUICreate("GUI", 405, 294, 539, 252) GUICtrlCreateLabel("Google", 16, 16, 61, 17) $Google = GUICtrlCreateIcon("", -1, 150,16,16,16) GUICtrlCreateLabel("Localhost", 16, 16, 61, 17) $Localhost = GUICtrlCreateIcon("", -1, 150,16,16,16) GUICtrlCreateLabel("Google2", 16, 16, 61, 17) $Google2 = GUICtrlCreateIcon("", -1, 150,16,16,16) GUISetState(@SW_SHOW) Local $i = 0 Do $Ping = Ping($Sites[$i][1]) If $Ping = 0 Then GUICtrlSetImage($Sites[$i][2], "bullet_red.ico", -1) EndIf If $Ping > 500 Then GUICtrlSetImage($Sites[$i][2], "bullet_orange.ico", -1) Else GUICtrlSetImage($Sites[$i][2], "bullet_green.ico", -1) EndIf $i = $i + 1 Until $i = UBound($Sites) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Link to comment Share on other sites More sharing options...
Developers Solution Jos Posted August 9, 2014 Developers Solution Share Posted August 9, 2014 (edited) The first parameter should contain the value of the handle returned by GUICtrlCreateIcon() So guess this should work: GUICtrlSetImage(Eval($Sites[$i][0]), "bullet_red.ico", -1) Jos Edited August 9, 2014 by Jos t1ck3ts 1 SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
t1ck3ts Posted August 9, 2014 Author Share Posted August 9, 2014 You're a star Jos! Thanks for the help. 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