[?] Clearing LstView Controls - Printable Version -Shoutbox (https://shoutbox.menthix.net) +-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58) +--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4) +---- Forum: Scripting (/forumdisplay.php?fid=39) +----- Thread: [?] Clearing LstView Controls (/showthread.php?tid=77946) [?] Clearing LstView Controls by Spunky on 10-03-2007 at 02:07 PM
I have trouble with this before, but for some reason this doesn't seem to clear the whole list, it always seems to leave the last item if there are more than 2-3 items in the list... Any idea why? It looks Ok to me and I've tried looping it more times, but it doesn't work code: RE: [?] Clearing LstView Controls by Matti on 10-03-2007 at 02:32 PM
Try this instead! code: RE: [?] Clearing LstView Controls by Volv on 10-03-2007 at 02:40 PM
Or you could use a while(PlusWnd.LstView_GetCount("ListView")) loop which would probably work as well. But I suppose Mattike's method is better RE: [?] Clearing LstView Controls by Spunky on 10-03-2007 at 02:49 PM
quote: That causes an error and so doesn't work quote: That just isn't removing any items quote: I was tracing the LstView_Count property and it never got down to zero... it would just keep looping at 1 EDIT: fixed a spelling mistake in Mattike's.... Now it does the same thing as Volv's... Lol. RE: [?] Clearing LstView Controls by Volv on 10-03-2007 at 02:58 PM
I believe your original problem is related to the fact that PlusWnd.LstView_GetCount("ListView") is not constant (it decreases each time you remove an item) and as such your 'i' isn't going through all the necessary loops. RE: [?] Clearing LstView Controls by Spunky on 10-03-2007 at 03:00 PM
I did manage to do it once before... RE: [?] Clearing LstView Controls by markee on 10-03-2007 at 03:03 PM
It should be code:This will give a boolean expression like the while statement wants This method I have found works well, I have used it before with Message Customizer! Live when I did the groups to clear out the list views. However, seeing as though Mattike uses windows API it might be quicker and nicer to use that (especially on larger lists). RE: [?] Clearing LstView Controls by Spunky on 10-03-2007 at 03:04 PM
quote: I did try that too... I might give it another go though RE: RE: [?] Clearing LstView Controls by Volv on 10-03-2007 at 03:07 PM
quote: code:Hmph, > owns != quote:You should have something like this: code: RE: [?] Clearing LstView Controls by markee on 10-03-2007 at 03:14 PM It doesn't matter if you use > or != in this situation because there is no time when it won't return a number equal to or greater than zero. This is because the only error is if the plus window does not exist or the control ID doesn't exist. As far as I can tell wouldn't it be quickest to do !== rather than the other 2? RE: RE: [?] Clearing LstView Controls by Matti on 10-03-2007 at 05:32 PM
quote:Uh? Then why does it work flawlessly here? Can you tell me the error please? RE: [?] Clearing LstView Controls by Spunky on 10-03-2007 at 05:45 PM
quote: Object Expected. Spelling mistake in your post... I did edit mine to tell you. It didn't seem to be working anyway, but then again neither did Volv's and that is working now. I think my PC is playing up and I have reset since I last posted. RE: [?] Clearing LstView Controls by roflmao456 on 10-03-2007 at 07:47 PM
yo. code: RE: [?] Clearing LstView Controls by phalanxii on 10-04-2007 at 12:47 AM
I would lean more towards using Mattike/roflmao456's method of using the LVM_DELETEALLITEMS message. RE: [?] Clearing LstView Controls by Matti on 10-04-2007 at 04:56 PM
Yes indeed, the LVM_DELETEALLITEMS is the best, most efficient and fastest way you can get: it's the pure Win32 API! (and we all love that thing don't we?) |