What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » GetCurSel and SetCurSel with ListViewControl...

GetCurSel and SetCurSel with ListViewControl...
Author: Message:
roflmao456
Skinning Contest Winner
****

Avatar

Posts: 955
Reputation: 24
30 / Male / Flag
Joined: Nov 2006
Status: Away
O.P. GetCurSel and SetCurSel with ListViewControl...
is there any function for this? i know there is one for the ListBox control but it doesn't seem to go with the ListView control :P it always returns 0
[quote]
Ultimatess6
: What a noob mod
08-17-2007 07:25 PM
Profile PM Web Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: GetCurSel and SetCurSel with ListViewControl...
code:
for (var i=0; pPlusWnd.LstView_GetCount('MyListView')-1; i++) {
    Debug.Trace(pPlusWnd.ListView_GetSelectedState('MyListView', i));
}
08-18-2007 12:35 AM
Profile E-Mail PM Find Quote Report
markee
Veteran Member
*****

Avatar

Posts: 1622
Reputation: 50
36 / Male / Flag
Joined: Jan 2006
RE: GetCurSel and SetCurSel with ListViewControl...
Because a LstView Control can have many selected at a time you will have to iterate through the options.  You actually check a single item rather than checking for which element is selected.  You can do something like the following code though....

code:
[...]
var SelectedState = new Array();
var count = PlusWnd.LstView_GetCount("ControlId");
for(i=0;i<count;i++){
    SelectedState[i] = PlusWnd.LstView_GetSelectedState("ControlId",i);
}
[...]


If you have your XML set so that you can only have one selected however just try this....

[code][...]
var count = PlusWnd.LstView_GetCount("ControlId");
for(i=0;i<count;i++){
    if(PlusWnd.LstView_GetSelectedState("ControlId",i)){
        var selected = i;
        break;
    }
}

As for setting one you just have to do it in much the same way as the ListBox except you need to put in the extra boolean variable for selecting or deselecting.
[Image: markee.png]
08-18-2007 12:40 AM
Profile PM Find Quote Report
roflmao456
Skinning Contest Winner
****

Avatar

Posts: 955
Reputation: 24
30 / Male / Flag
Joined: Nov 2006
Status: Away
O.P. RE: GetCurSel and SetCurSel with ListViewControl...
that worked perfectly, thanks! (Y)(Y)
[quote]
Ultimatess6
: What a noob mod
08-18-2007 02:40 AM
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