What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » List box clearing?

List box clearing?
Author: Message:
SmokingCookie
Senior Member
****

Avatar

Posts: 815
Reputation: 15
30 / Male / Flag
Joined: Jul 2007
O.P. List box clearing?
Hi,

Is there some WM_(X)-message that clears a ListBoxControl entirely?

I have tried this piece of code, without success:

code:
        for(i = 0; i <= PlusWnd.LstBox_GetCount("bLstFolders"); i++) {
            PlusWnd.LstBox_RemoveItem("bLstFiles",i);
        }


This post was edited on 07-13-2008 at 08:56 PM by SmokingCookie.
07-13-2008 08:55 PM
Profile PM Find Quote Report
foaly
Senior Member
****

Avatar

Posts: 718
Reputation: 20
38 / Male / Flag
Joined: Jul 2006
RE: List box clearing?
try:

code:
while(wnd.LstBox_GetCount("list")>0){
        wnd.LstBox_RemoveItem("list",0);
    }

07-13-2008 09:00 PM
Profile E-Mail PM Find Quote Report
SmokingCookie
Senior Member
****

Avatar

Posts: 815
Reputation: 15
30 / Male / Flag
Joined: Jul 2007
O.P. RE: List box clearing?
Has anybody told you that you were clever? :P

Works, tnx :D
07-13-2008 09:05 PM
Profile PM Find Quote Report
TheSteve
Full Member
***

Avatar
The Man from Japan

Posts: 179
Reputation: 23
40 / Male / Flag
Joined: Aug 2005
RE: List box clearing?
I'm not sure if the MsgPlus list box is implemented with the windows list box or not, but if it is, sending the LB_RESETCONTENT message should immediately empty it.
07-14-2008 01:01 AM
Profile PM Web Find Quote Report
SmokingCookie
Senior Member
****

Avatar

Posts: 815
Reputation: 15
30 / Male / Flag
Joined: Jul 2007
O.P. RE: RE: List box clearing?
That does it :D

Thanks :D

-----------------------------------
quote:
Originally posted by foaly
try:

code:
while(wnd.LstBox_GetCount("list")>0){
        wnd.LstBox_RemoveItem("list",0);
    }



I've tried this trick on a ListBoxControl and it seemed to work. On a ListViewControl, however, it crashes Messenger.. Is there any reason or solution to this problem?

code:
    while(WndSkinEditor.LstView_GetCount("vLstElementsLeft") >= 0) {
        WndSkinEditor.LstView_RemoveItem("vLstElementsLeft",0);
    }
    Debug.Trace("> Clearing \" vLstElementsRight\"");
    while(WndSkinEditor.LstView_GetCount("vLstElementsRight") >= 0) {
        WndSkinEditor.LstView_RemoveItem("vLstElementsRight",0);
    }

This post was edited on 07-14-2008 at 04:56 PM by SmokingCookie.
07-14-2008 04:54 PM
Profile PM Find Quote Report
Matti
Elite Member
*****

Avatar
Script Developer and Helper

Posts: 1646
Reputation: 39
31 / Male / Flag
Joined: Apr 2004
RE: List box clearing?
It's much better to use the Win32 control messages for this, as if you make a mistake in your while-loop, you'll end up in an endless loop of doom and thus crashing your Messenger.

For list boxes:
code:
PlusWnd.SendControlMessage("ListBox", /* LB_RESETCONTENT */ 0x184, 0, 0);
For list views:
code:
PlusWnd.SendControlMessage("ListView", /* LVM_DELETEALLITEMS */ 0x1009, 0, 0);
The worst thing you can get then is a "bad calling convention" or something in your Interop.GetLastError(). :P

Blah, you already solved it yourself. Anyway, this post is for future generations. :P

This post was edited on 07-14-2008 at 05:02 PM by Matti.
Plus! Script Developer | Plus! Beta Tester | Creator of Countdown Live | Co-developer of Screenshot Sender 5

Found my post useful? Rate me!
07-14-2008 05:01 PM
Profile E-Mail PM Web Find Quote Report
SmokingCookie
Senior Member
****

Avatar

Posts: 815
Reputation: 15
30 / Male / Flag
Joined: Jul 2007
O.P. RE: List box clearing?
Yeah, excuses hea :P

Anyway, thanks for the solution (and for CDL 2.1 :D )
07-14-2008 05:05 PM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On