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

clear combobox
Author: Message:
tombotxp
New Member
*


Posts: 4
Joined: Aug 2004
O.P. clear combobox
Is it possible to clear a whole combobox? The following code doesn't work!

code:
function ClearCombobox(){
    for (i=0; i < window.Combo_GetCount("combobox"); i++){
        window.Combo_RemoveItem("combobox", i);
    }

}
06-26-2006 12:51 PM
Profile E-Mail PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: clear combobox
Well firstly make sure that window is a declared variable and has taken on the PlusWnd type.

so
code:
var window = CreateWnd("file.xml", "wndwindow");

I would suggest doing something like this

code:
funciton ClearComboBox(Wnd, sControlId){
    for (var i=0; Wnd.Combo_GetCount(sControlId)-1; i++){
        Wnd.Combo_RemoteItem(sControlId, i);
    }
}

Then to use it you use:
code:
ClearComboBox(Window, "combobox");




Oops duh!

* matty slaps himself

Sorry about that

This post was edited on 06-26-2006 at 02:31 PM by matty.
06-26-2006 12:58 PM
Profile E-Mail PM Find Quote Report
tombotxp
New Member
*


Posts: 4
Joined: Aug 2004
O.P. RE: clear combobox
that doesn't work!
06-26-2006 01:45 PM
Profile E-Mail PM Find Quote Report
-dt-
Scripting Contest Winner
*****

Avatar
;o

Posts: 1819
Reputation: 74
36 / Male / Flag
Joined: Mar 2004
RE: clear combobox
of course it doesnt ... as you remove one the index changes!

just change

code:
window.Combo_RemoveItem("combobox", i);


to

code:
window.Combo_RemoveItem("combobox", 0);

[Image: dt2.0v2.png]      Happy Birthday, WDZ
06-26-2006 01:59 PM
Profile PM Web 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