Sign in to follow this  
Followers 0
chssoccer

Set Image

5 posts in this topic

#1 ·  Posted (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 by chssoccer

Share this post


Link to post
Share on other sites



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

Share this post


Link to post
Share on other sites

#3 ·  Posted (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 by chssoccer

Share this post


Link to post
Share on other sites

I know the problem has to do with this line

If $Online = 0 Then; If there are 0 then set the following image

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0