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.

DarkBASIC Professional Discussion / BlueGUI removeListViewItem() Question !!!

Author
Message
Towfieee
20
Years of Service
User Offline
Joined: 5th Jun 2006
Location:
Posted: 24th May 2010 04:53
Hello Everyone,

Straight to the subject ... BlueGUI plugin comes with an example about "ListView". The project allows us to browse through the directories and choose one to view all the images in it as a gallery.

The Problem: After you select the folder and the list appears if you try and select another folder it will add more images to the already existing gallery. So the images from the old and the new folders are included.

What I have tried to do:I tried to do a checklist and see how many files we have in the "listView" and remove them one after the other before requesting another folder like the following:



The Result:Not everything in the list is being removed and when I select new folder it will still show the older images.

What am I doing wrong?
Hockeykid
DBPro Tool Maker
18
Years of Service
User Offline
Joined: 26th Sep 2007
Location:
Posted: 24th May 2010 05:13
In your example code for removing a view item what is t equal to?

Towfieee
20
Years of Service
User Offline
Joined: 5th Jun 2006
Location:
Posted: 24th May 2010 06:53
It's a mistake when I wrote the code in here. I meant "i"

Hockeykid
DBPro Tool Maker
18
Years of Service
User Offline
Joined: 26th Sep 2007
Location:
Posted: 24th May 2010 07:12
It would be better to have a variable hold the amount of list view items when they're being added and then for loop from 1 to the new variable to make sure you get them all deleted .

If your source is not to "private" post it (without the BlueGUI UserID and Password of course) and I can fix it up for you .

sladeiw
17
Years of Service
User Offline
Joined: 16th May 2009
Location: UK
Posted: 24th May 2010 12:12 Edited at: 24th May 2010 12:31
The problem is that you're deleting top-down order. Say you have 100 items initially, when the loop gets to i=100, the listview will contain less items. Do it backwards and it will work fine. (Also, listview row numbers start from 0 so the last item is count-1)



Edit: Also, don't forget to turn off auto-updating before mass-deleting because it's very slow otherwise. (And turn on again after!)

Towfieee
20
Years of Service
User Offline
Joined: 5th Jun 2006
Location:
Posted: 25th May 2010 09:02
Now Works Perfect

Thanks hockeykid I changed the variable "listView_count" to global and used it to delete the items in the list in a seperate function.

sladeiw I appreciate the help. Deleting the items in a reversed order solved the problem.

Here is a pieces of the code from the example that came with the plug in . I modified it a little ....

Login to post a reply

Server time is: 2026-07-25 08:29:40
Your offset time is: 2026-07-25 08:29:40