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:
SmokingCookie
Senior Member
****

Avatar

Posts: 815
Reputation: 15
29 / Male / Flag
Joined: Jul 2007
O.P. [HELP] Get/set item text
Hi,

I have a(nother) question:

"PlusWndObject.LstView_SetItemText" and "PlusWndObject.LstView_SetItemText" don't work..

Code 1 (SET):

code:
for(i = 1; i <= LastNotif; i++) {
D = XmlParser.selectSingleNode("//Notification" + i);
NotificationNames[i] = D.getAttribute("Value");
WndNotifs.LstView_AddItem("LstVNotifs",NotificationNames[i]);
NotificationPages[i] = Script.MainUrl + D.getAttribute("Page");
WndNotifs.LstView_SetItemText("LstVNotifs",i,2,NotificationPages[i]);
}


Code 2 (GET):

code:
nPage = WndNotifs.LstView_GetItemText("LstVNotifs",ItemIdx,2);


"get" returns nothing.. Set does nothing either..

Could anybody please help me?

This post was edited on 05-14-2008 at 05:20 PM by SmokingCookie.
05-14-2008 05:19 PM
Profile PM Find Quote Report
mynetx
Skinning Contest Winner
*****

Avatar
Microsoft insider

Posts: 1175
Reputation: 33
36 / Male / Flag
Joined: Jul 2007
RE: [HELP] Get/set item text
Hello SmokingCookie,

try opening the Script Debug window and use the Debug.Trace method to see what is going on. Any errors in the debug window? Also try validating your Window XML, using Interface Tester. Post your results here.

Regards,
mynetx

/edit: please edit your avatar url to point to a valid image rather than to http://img81.imageshack.us/my.php?image=draughtsdx2.jpg ...

This post was edited on 05-14-2008 at 05:40 PM by mynetx.
mynetx - Microsoft, enhanced.

You have a problem or issue with Windows, Internet
Explorer or Office?
Send a tweet!
05-14-2008 05:29 PM
Profile E-Mail PM Web Find Quote Report
SmokingCookie
Senior Member
****

Avatar

Posts: 815
Reputation: 15
29 / Male / Flag
Joined: Jul 2007
O.P. RE: [HELP] Get/set item text
XML is valid (already checked it a thousand times).

nPage returns an empty string (in the debugger).
No errors revealed either..
Please note that in both cases I need the second column from the right.
05-14-2008 05:36 PM
Profile PM Find Quote Report
mynetx
Skinning Contest Winner
*****

Avatar
Microsoft insider

Posts: 1175
Reputation: 33
36 / Male / Flag
Joined: Jul 2007
RE: [HELP] Get/set item text
Your loop goes from i = 1 to the i = LastNotif.
But the index in the ListView is null-based... so why not try
WndNotifs.LstView_SetItemText("LstVNotifs",i-1,2,NotificationPages[i]);
instead of
WndNotifs.LstView_SetItemText("LstVNotifs",i,2,NotificationPages[i]);
?
mynetx - Microsoft, enhanced.

You have a problem or issue with Windows, Internet
Explorer or Office?
Send a tweet!
05-14-2008 05:42 PM
Profile E-Mail PM Web Find Quote Report
SmokingCookie
Senior Member
****

Avatar

Posts: 815
Reputation: 15
29 / Male / Flag
Joined: Jul 2007
O.P. RE: [HELP] Get/set item text
Doesn't matter: I have 3 items to be loaded in the listview conrol, none of them have text in the 2nd collumn..
05-14-2008 05:46 PM
Profile PM Find Quote Report
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
SmokingCookie
Senior Member
****

Avatar

Posts: 815
Reputation: 15
29 / Male / Flag
Joined: Jul 2007
O.P. RE: [HELP] Get/set item text
Wow, you guys managed to fix it :D :P

Thanks (again (A) ) :D

EDIT::

That's indeed very clear, thank you very much :D

This post was edited on 05-14-2008 at 06:51 PM by SmokingCookie.
05-14-2008 05:58 PM
Profile PM 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