htrd Posted April 27, 2016 Share Posted April 27, 2016 Hi, how can I destroy an icon I created for a control by GUICtrlSetImage() ? I want to create an icon for a ListViewItem created by GUICtrlCreateListViewItem(). This works fine by using the func G'UICtrlSetImage() on the ListViewItem handle. Now I want the ListViewItem to be displayed without an icon. How can I do that? I already tested with GUICtrlSendMsg() but didn't come to a working result. I also tried the function posted in this thread: ...but this function doesn't seem to work either (at least on a ListViewItem). Thanks in advance for your help guys! Cheers htrd Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted April 27, 2016 Moderators Share Posted April 27, 2016 @htrd can you please post your code so we can see what you're doing? For a normal GuiCtrlSetImage I usually just set it to a blank icon, like below, but I know there are some peculiarities when you're setting the image on a TreeView or ListView item (see help file for these). If you post your full code it'll save us from trying to guess at what you're trying to do #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> GUICreate("Test") $btnButton = GUICtrlCreateButton("", 10, 20, 40, 40, $BS_ICON) GUICtrlSetImage(-1, "shell32.dll", 22) $btnChange = GUICtrlCreateButton("Change Me", 300, 330, 80, 40) GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $btnChange GUICtrlSetImage($btnButton, "shell32.dll", 50) EndSwitch WEnd "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
htrd Posted April 27, 2016 Author Share Posted April 27, 2016 $aLabelSender[$i] = GUICtrlCreateListViewItem("", $LVStreams) GUICtrlSetData($aLabelSender[$i], $message & "|" & $statestream & "|" & $remaining & "%") GUICtrlSetFont($aLabelSender[$i], 9, 800) If $aStreaming[$i] = 1 Then If $aColor[$i] = "0x00cc33" Then ; Else GUICtrlSetColor($aLabelSender[$i], 0x00cc33) GUICtrlSetImage($aLabelSender[$i], "shell32.dll", 148) $aColor[$i] = "0x00cc33" EndIf Else If $aColor[$i] = "0x63CC00" Then ; Else GUICtrlSetColor($aLabelSender[$i], 0x63CC00) $aColor[$i] = "0x63CC00" ; HERE I WANT TO REMOVE THE ICON EndIf EndIf Here's a code snippet of what I do and what I want to achieve. Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted April 27, 2016 Moderators Share Posted April 27, 2016 And did you try what I suggested above, setting it to one of the blank indexes? "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
htrd Posted April 27, 2016 Author Share Posted April 27, 2016 Well, I thought of using an empty icon myself, I guess that works and it's a nice workaround of course, but I wanted to know if I can completely destroy the icon so that the text of the ListViewItem is left-alligned without a gap. That's just for cosmetical purposes of course. Maybe someone has another solution to it, anyway thanks for your help JLogan3o13! Cheers htrd 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