What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » [HELP] Get/set item text

[HELP] Get/set item text
Author: Message:
CookieRevised
Elite Member
*****

Avatar

Posts: 15519
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: [HELP] Get/set item text
The row and columns of a listview are base-0.
This means that the first row is row 0 (not row 1) and the first column is column 0 (not column 1).

code:
for(i = 1; i <= LastNotif; i++) {
    D = XmlParser.selectSingleNode("//Notification" + i);
    NotificationNames[i] = D.getAttribute("Value");
    // Adds a new item in the first column (column index 0) and on the next row (which is row with index 0 in the first iteration of the loop, not index 1)
    WndNotifs.LstView_AddItem("LstVNotifs",NotificationNames[i]);
    NotificationPages[i] = Script.MainUrl + D.getAttribute("Page");
    // Yet here you tell Plus! to add data in the third column (index 2) on the second row (index "i"), which doesn't exist yet
    WndNotifs.LstView_SetItemText("LstVNotifs",i,2,NotificationPages[i]);
}
If you want to keep the i variable starting at 1 you must substract 1 from the index for the row and column you whish to set...

Same for GetItemText.

To make it very clear: If you want this kind of list:

Name          Age
----------------------
Jana            25
Chris            19
Kurt             31

You would do:
LstView_AddItem("mylist", "Jana")
LstView_SetItemText("mylist", 0, 1, "25")

LstView_AddItem("mylist", "Chris")
LstView_SetItemText("mylist", 1, 1, "19")

LstView_AddItem("mylist", "Kurt")
LstView_SetItemText("mylist", 2, 1, "31")

and:

LstView_GetItemText("mylist", 0, 0) will return "Jana"
LstView_GetItemText("mylist", 1, 1) will return "19"

This post was edited on 05-14-2008 at 06:05 PM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
05-14-2008 05:53 PM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
[HELP] Get/set item text - by SmokingCookie on 05-14-2008 at 05:19 PM
RE: [HELP] Get/set item text - by mynetx on 05-14-2008 at 05:29 PM
RE: [HELP] Get/set item text - by SmokingCookie on 05-14-2008 at 05:36 PM
RE: [HELP] Get/set item text - by mynetx on 05-14-2008 at 05:42 PM
RE: [HELP] Get/set item text - by SmokingCookie on 05-14-2008 at 05:46 PM
RE: [HELP] Get/set item text - by CookieRevised on 05-14-2008 at 05:53 PM
RE: [HELP] Get/set item text - by SmokingCookie on 05-14-2008 at 05:58 PM


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