-Ultima- Posted November 21, 2007 Share Posted November 21, 2007 (edited) randallc hit the nail on the head. The reason you're having trouble is because you're trying to set the data for a listview item, which means you're supposed to be using GUICtrlSetData() on a listview item. Instead, you're passing the handle to the listview itself into GUICtrlSetData() -- this has no meaning, as you don't set the data of a listview; you set the data for the listview item in the listview.The only way you can modify a specific listivew item is if you store the handle for it (an array probably being the easiest way, as randallc has it) and run GUICtrlSetData() on the particular handle that you want. I'm not sure if randallc's example will work properly, though, as I believe GUICtrlSetData($nListViewItem, "Text") will wipe out the text for both columns and replace it with "Text" in the first column. If so, then you're going to have to use GUICtrlRead() on the target listview item, split the returned string using StringSplit(), replace the first item in the split array, join the array together again into a single string, then use GUICtrlSetData() on the control with the newly-formed text.Using the GUIListView.au3 UDFs to set (sub)item text would probably make things easier. Edited November 21, 2007 by -Ultima- [ WinINet.au3 | Array.au3 (Optimized) | _UnixTimeParse() ] Link to comment Share on other sites More sharing options...
FireLord Posted November 21, 2007 Author Share Posted November 21, 2007 (edited) randallc hit the nail on the head. The reason you're having trouble is because you're trying to set the data for a listview item, which means you're supposed to be using GUICtrlSetData() on a listview item. Instead, you're passing the handle to the listview itself into GUICtrlSetData() -- this has no meaning, as you don't set the data of a listview; you set the data for the listview item in the listview.The only way you can modify a specific listivew item is if you store the handle for it (an array probably being the easiest way, as randallc has it) and run GUICtrlSetData() on the particular handle that you want. I'm not sure if randallc's example will work properly, though, as I believe GUICtrlSetData($nListViewItem, "Text") will wipe out the text for both columns and replace it with "Text" in the first column. If so, then you're going to have to use GUICtrlRead() on the target listview item, split the returned string using StringSplit(), replace the first item in the split array, join the array together again into a single string, then use GUICtrlSetData() on the control with the newly-formed text.Using the GUIListView.au3 UDFs to set (sub)item text would probably make things easier.Actually the reason why I was having trouble was because the items I was trying to copy were not from a listview but a listbox. I figured this out in this post: http://www.autoitscript.com/forum/index.php?showtopic=57692 Edited November 21, 2007 by FireLord [center]See the Helpfile[/center] While Alive() DrinkWine(); }[center][/center] Link to comment Share on other sites More sharing options...
-Ultima- Posted November 21, 2007 Share Posted November 21, 2007 That doesn't actually explain this:I did GUICtrlSetData($nListview, "Yes") and now it's not even showing up in the listview.But as long as you've got the problem fixed, then good enough [ WinINet.au3 | Array.au3 (Optimized) | _UnixTimeParse() ] Link to comment Share on other sites More sharing options...
FireLord Posted November 21, 2007 Author Share Posted November 21, 2007 (edited) That doesn't actually explain this: But as long as you've got the problem fixed, then good enough Well not quite, I'm stuck on a little bug in some new code but if I can manage to get past it then I know it'll work. What I'm trying to do is get all the items from the listbox and copy them into my listview. If IsArray($buddiesSearch) Then For $i = 1 To $buddiesSearch[0] Send($buddiesSearch[$i] & "{Enter}"); Search for each individual player Next Sleep(500) For $i = 0 To _GUICtrlListCount($ListBox) - 1 GUICtrlCreateListViewItem("|" & _GUICtrlListGetText($ListBox, $i), $nListView) Next But anything after the second For loop does not work... Edited November 21, 2007 by FireLord [center]See the Helpfile[/center] While Alive() DrinkWine(); }[center][/center] 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