newcomer11 Posted February 25, 2008 Posted February 25, 2008 Can we track the "add listview item message" ? Some thing like "hook" in AutoIt? Thank you
Siao Posted February 25, 2008 Posted February 25, 2008 (edited) Internal listview? LVN_INSERTITEM. But then you should've posted in GUI support forum. External? Then polling item count/text would be about the only option available to you. Edited February 25, 2008 by Siao "be smart, drink your wine"
newcomer11 Posted February 25, 2008 Author Posted February 25, 2008 External? Then polling item count/text would be about the only option available to you.Hi, I'm new to AutoIt so can you give me an example of external listview : detect ListView Add item event, and change the item text before add it to LV? I can get it handle of the LV but don't know what to do next
Siao Posted February 25, 2008 Posted February 25, 2008 Hi, I'm new to AutoIt so can you give me an example of external listview : detect ListView Add item event, and change the item text before add it to LV? I can get it handle of the LV but don't know what to do next You won't be able to change text "before", as you'll only know "after".What you can do is, using GuiListView functions (see helpfile) - such as _GUICtrlListView_GetItemCount, and a While loop, know when number of items in an external listview changes, then maybe compare all item texts against old values to know which one is new, then change it with _GUICtrlListView_SetItemText. "be smart, drink your wine"
newcomer11 Posted February 25, 2008 Author Posted February 25, 2008 Thank you for you fast replying You won't be able to change text "before", as you'll only know "after".Sorry if I miss understanding, but I think that when I catch the LVN_INSERTITEM message, I able to modify the item text then send to the LV ?using GuiListView functions (see helpfile) - such as _GUICtrlListView_GetItemCount, and a While loop, know when number of items in an external listview changes, then maybe compare all item texts against old values to know which one is new, then change it with _GUICtrlListView_SetItemText.Very good solution, but this is not the best if some new texts are same the old one? And when I change it with _GUICtrlListView_SetItemText, does the LV "flash" ?
Siao Posted February 25, 2008 Posted February 25, 2008 Sorry if I miss understanding, but I think that when I catch the LVN_INSERTITEM message, I able to modify the item text then send to the LV ?With that message you are notified about the fact that a new item was inserted in your listview and get its index.Very good solution, but this is not the best if some new texts are same the old one?Then keep text and index of each item, and compare against both. Where this really wouldn't work reliably is if the listview is editable and item texts can change without your knowing. Or if it happens too fast, too often, etc, which is main weakness of polling approach in general.Or maybe try _GUICtrlListView_MapIndexToID. "be smart, drink your wine"
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