Shoutbox

clear combobox - 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: clear combobox (/showthread.php?tid=61570)

clear combobox by tombotxp on 06-26-2006 at 12:51 PM

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);
    }

}

RE: clear combobox by matty on 06-26-2006 at 12:58 PM

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
RE: clear combobox by tombotxp on 06-26-2006 at 01:45 PM

that doesn't work!


RE: clear combobox by -dt- on 06-26-2006 at 01:59 PM

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);