JD2066 Posted January 16, 2006 Posted January 16, 2006 (edited) Hi,I have used GUICtrlSetImage to set icons on listview items and want to by able to sort the listview by clicking on the headers.I have searched the fourm and found a few ways to do that but found a few problems:1. If I use the included listview sort UDF the images don't get sorted.2. If I use the UDF I found here there is some flicker.I was thinking if there was a way to get the image set on a listview item I might be able to update the above UDF so there wasn't as much flicker.Anyone know a way to get the image set by GUICtrlSetImage?I am using Windows XP and AutoIt version 3.1.1.99.JustinUpdate:Problem Solved now.See my last post. Edited January 21, 2006 by JD2066
Oxin8 Posted January 16, 2006 Posted January 16, 2006 Hi,I have used GUICtrlSetImage to set icons on listview items and want to by able to sort the listview by clicking on the headers.I have searched the fourm and found a few ways to do that but found a few problems:1. If I use the included listview sort UDF the images don't get sorted.2. If I use the UDF I found here there is some flicker.I was thinking if there was a way to get the image set on a listview item I might be able to update the above UDF so there wasn't as much flicker.Anyone know a way to get the image set by GUICtrlSetImage?I am using Windows XP and AutoIt version 3.1.1.99.JustinCouldn't you just store the last image set in a variable? Or if dealing with multiple images, an array? ~My Scripts~ *********_XInput UDF for Xbox 360 ControllerSprayPaint_MouseMovePlus
JD2066 Posted January 16, 2006 Author Posted January 16, 2006 Couldn't you just store the last image set in a variable? Or if dealing with multiple images, an array?I thought about that idea but it also has a few problems:1. I'm adding items to the listview with a "For...In" loop so I don't have a total amount of items to dim the array with.2. Because the items could be sorted more then one time the array would have to be recreated each time it's sorted.I think I might be able to do that by add the items to a string during each loop and split the string into an array after that though it would be easier with a GUICtrlGetImage type function.I'm also not sure of the performance impact of doing that vs diming an array from the start though with only a few hundred users and only needing to store the icon index as the file is the same it might not be noticable.Justin
Oxin8 Posted January 16, 2006 Posted January 16, 2006 could you post an example script for me to try to work with? i've been browsing around for a solution and i think it's time to just try to do it. ~My Scripts~ *********_XInput UDF for Xbox 360 ControllerSprayPaint_MouseMovePlus
JD2066 Posted January 16, 2006 Author Posted January 16, 2006 (edited) could you post an example script for me to try to work with? i've been browsing around for a solution and i think it's time to just try to do it.My script is a User Management script that pulls a user list from Active Directory.So my script won't really work for you unless you have a computer joined to a domain to test it on.But the listview sorting code I copyed from the example on the last post here with the only real differences being that in my script the the users are added to the listview when an OU is selected and the two hidden columns end up showing when doing that.Justin Edited January 16, 2006 by JD2066
Oxin8 Posted January 16, 2006 Posted January 16, 2006 I got on the windows api reference and found something called Listview_GetImageList and I was all psyched to help you. So I made a function for it only to realized that it simply returns the imagelist handle for use in the SetImageList function. So I basically came up empty. Sorry. ~My Scripts~ *********_XInput UDF for Xbox 360 ControllerSprayPaint_MouseMovePlus
JD2066 Posted January 16, 2006 Author Posted January 16, 2006 I got on the windows api reference and found something called Listview_GetImageList and I was all psyched to help you. So I made a function for it only to realized that it simply returns the imagelist handle for use in the SetImageList function. So I basically came up empty. Sorry.Thats ok. Thanks for looking.I think I'll just have to keep the sorting code I have the way it is then as I've already spent to much time on it.It seems like sorting while keeping the images right by clicking the header should be built in to the listview control but I guess someone on the Windows Dev team thought otherwise.Justin
JD2066 Posted January 21, 2006 Author Posted January 21, 2006 I just downloaded AutoIt 3.1.1.103 and found a new function GUICtrlRegisterListViewSort. I looked at the example code, copyed it to my script and after debugging it a bit I got it to work. I made it work by lowering the sleep time in my main loop. I guess it had something to do with the example using MessageLoop mode and my script using EventMode. I don't really have any idea how the code works but it does. Justin
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