Shoutbox

Combo_GetItemData help [SOLVED] - 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: Combo_GetItemData help [SOLVED] (/showthread.php?tid=67869)

Combo_GetItemData help [SOLVED] by pollolibredegrasa on 10-30-2006 at 05:23 PM

OK I'm using the code below to add statuses to a combo box, and I'm using the ItemData parameter to store the Status codes.

code:
    OptsWnd.Combo_AddItem("CmbStatus", "Busy", 4);
    OptsWnd.Combo_AddItem("CmbStatus", "Be Right Back",5);   
    OptsWnd.Combo_AddItem("CmbStatus", "Away",7);
    OptsWnd.Combo_AddItem("CmbStatus", "In a Call",8);
    OptsWnd.Combo_AddItem("CmbStatus", "Out To Lunch",9);
   
    for (var i = 0; i <= OptsWnd.Combo_GetCount("CmbStatus"); i++){
         Debug.trace(OptsWnd.Combo_GetItemData("CmbStatus", i));
    }

^^ But when I use GetItemData on the items in that for loop, it ouputs 0 for all of them. I don't know whats wrong, as the combo box IS created in my window, and it IS filled.

Can anyone offer any suggestions?
RE: Combo_GetItemData help by Mnjul on 10-30-2006 at 06:13 PM

My experience tells me that you need to select the item first to make GetItemData return the correct value.

That is,

code:
for (var i = 0; i <= OptsWnd.Combo_GetCount("CmbStatus"); i++){
     OptsWnd.Combo_SetCurSel("CmbStatus",i);
     Debug.trace(OptsWnd.Combo_GetItemData("CmbStatus", i));
}


RE: Combo_GetItemData help by pollolibredegrasa on 10-30-2006 at 06:14 PM

Worked, thanks Mnjul :)