chssoccer Posted January 1, 2008 Share Posted January 1, 2008 (edited) Hi, I'm trying to set two different types of images in my listview depending on the outcome of something. If a buddy that is searched for is "Online" then it will set a certain image, otherwise it will set a different image. Here's what I have so far but it's not working... For $i = 1 To $buddiesSearch[0] ControlSend("Find Player", "", $Edit, $buddiesSearch[$i] & "{Enter}"); Searches for each individual player $ListBox = ControlGetHandle ( "Find Player", "", "ListBox1" ); Gets handle of external listbox For $a = 0 To _GUICtrlListCount($ListBox) - 1 GUICtrlCreateListViewItem(_GUICtrlListGetText($ListBox, $a), $sListview) $Online = _GUICtrlListCount($ListBox); Counts how many items are in the external listbox If $Online = 0 Then; If there are 0 then set the following image GUICtrlSetImage($nListview, "shell32.dll", -110) Else GUICtrlSetImage($nListview, "shell32.dll", -138); otherwise EndIf Next ControlSetText("Find Player", "", "Edit1", ""); Reset the edit Next My main goal is how can I set an image if a player is online and a different if he's offline. NOTE: I am going to have more than one buddy to search for and a problem I've been getting was it would search for one buddy and if he's online it would set all of the buddies to online. Thanks. Edited January 1, 2008 by chssoccer Link to comment Share on other sites More sharing options...
Zedna Posted January 1, 2008 Share Posted January 1, 2008 For $i = 1 To $buddiesSearch[0] ControlSend("Find Player", "", $Edit, $buddiesSearch[$i] & "{Enter}"); Searches for each individual player $ListBox = ControlGetHandle ( "Find Player", "", "ListBox1" ); Gets handle of external listbox For $a = 0 To _GUICtrlListCount($ListBox) - 1 $id = GUICtrlCreateListViewItem(_GUICtrlListGetText($ListBox, $a), $sListview) $Online = _GUICtrlListCount($ListBox); Counts how many items are in the external listbox If $Online = 0 Then; If there are 0 then set the following image GUICtrlSetImage($id, "shell32.dll", -110) Else GUICtrlSetImage($id, "shell32.dll", -138); otherwise EndIf Next ControlSetText("Find Player", "", "Edit1", ""); Reset the edit Next Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
chssoccer Posted January 1, 2008 Author Share Posted January 1, 2008 (edited) For $i = 1 To $buddiesSearch[0] ControlSend("Find Player", "", $Edit, $buddiesSearch[$i] & "{Enter}"); Searches for each individual player $ListBox = ControlGetHandle ( "Find Player", "", "ListBox1" ); Gets handle of external listbox For $a = 0 To _GUICtrlListCount($ListBox) - 1 $id = GUICtrlCreateListViewItem(_GUICtrlListGetText($ListBox, $a), $sListview) $Online = _GUICtrlListCount($ListBox); Counts how many items are in the external listbox If $Online = 0 Then; If there are 0 then set the following image GUICtrlSetImage($id, "shell32.dll", -110) Else GUICtrlSetImage($id, "shell32.dll", -138); otherwise EndIf Next ControlSetText("Find Player", "", "Edit1", ""); Reset the edit Next First off that's the wrong listview to put the images in. Did you not think I had $nListview there for a reason? Second, that's the only thing that changes is the location, it still has the same problem. The problem I'm having right now is it isn't showing the image "shell32.dll", -110. It shows the other one, but when it goes to this line $Online = 0 Then it may not equal 0 even though a buddy isn't in the listbox. How can I get the "shell32.dll", -110 image to show when there's nothing in the $Listbox? Edited January 1, 2008 by chssoccer Link to comment Share on other sites More sharing options...
chssoccer Posted January 1, 2008 Author Share Posted January 1, 2008 I know the problem has to do with this line If $Online = 0 Then; If there are 0 then set the following image Link to comment Share on other sites More sharing options...
John117 Posted January 2, 2008 Share Posted January 2, 2008 First off you should check your attitude before going off on someone that is trying to help you. -And an MVP at that! Second, I will be in shock if anyone else tries to help you. 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