Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DLL Talk / BlueGUI List View Question!

Author
Message
Olby
20
Years of Service
User Offline
Joined: 21st Aug 2003
Location:
Posted: 25th Jan 2006 17:55 Edited at: 25th Jan 2006 17:55
Never really got a chance to try this gadget... I encountered thing that I simply cant delete all listView items in one loop like:



It looks like listView items ID does not start with 0 and end with MAX ITEM COUNT because after I run this loop half of the items are still there and arn't removed!

"Gangsters die, they don't go to heaven where angels fly!"
AMD Sempron 3.1+ Ghz, 512MB Ram, ATI R9550 256MB Ram, Sound Blaster Live!, WinXP SP2, DirectX 9.0c
The Fat Centurion
19
Years of Service
User Offline
Joined: 4th Dec 2004
Location: Swindon, UK
Posted: 25th Jan 2006 22:21
Hi Olby,

iv found with this gadget that when you want to delete all in the list you leave the last parameter of removeListViewGadgetItem as 0..
ie


the last parameter seems to be the Listview Index of the Item you want to delete so using zero, always deletes the first item, then the rest move down..

Hope this help ya.
Olby
20
Years of Service
User Offline
Joined: 21st Aug 2003
Location:
Posted: 26th Jan 2006 12:22
Ah I think that removing item 0 removes the invisible parent item of the list view gadget, so that other items are removed automatically too.

I found another way removing all items that helped me:


Although it has a serious impact on speed, but atleast it works 100%.

"Gangsters die, they don't go to heaven where angels fly!"
AMD Sempron 3.1+ Ghz, 512MB Ram, ATI R9550 256MB Ram, Sound Blaster Live!, WinXP SP2, DirectX 9.0c
Rob K
Retired Moderator
21
Years of Service
User Offline
Joined: 10th Sep 2002
Location: Surrey, United Kingdom
Posted: 2nd Feb 2006 22:06
Hi Olby,

Removing item 0 only removes item 0. There is no invisible parent item.

There is a logical bug in your first piece of code, which is why it doesn't work. Every time you delete an item, all the indicies shift down one. So if there are 10 items in the list, and you delete one, there will only be 9 items in the list. So a For-Loop that tries to delete items with indicies from 0 to 10 would not work because by the time that it tries to delete the item at index 5, there are only 5 items left, and the highest valid index is 4, so it will fail.

The correct code is:



Which removes the first item in the list until there are no more left.

Here is some code to demonstrate:




BlueGUI Windows Plugin
Olby
20
Years of Service
User Offline
Joined: 21st Aug 2003
Location:
Posted: 3rd Feb 2006 20:06 Edited at: 1st Apr 2006 23:23
Wow thanks a lot for explaining this!

"Gangsters die, they don't go to heaven where angels fly!"
AMD Sempron 3.1+ Ghz, 512MB Ram, ATI R9550 256MB Ram, Sound Blaster Live!, WinXP SP2, DirectX 9.0c

Login to post a reply

Server time is: 2024-05-25 07:40:27
Your offset time is: 2024-05-25 07:40:27