What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » [?] LstView_SetItemText not working

[?] LstView_SetItemText not working
Author: Message:
Spunky
Former Super Mod
*****

Avatar

Posts: 3658
Reputation: 61
36 / Male / Flag
Joined: Aug 2006
O.P. Huh?  [?] LstView_SetItemText not working
The code (below) doesn't seem to be working right. I'm making a list of all my contacts and then trying to read nicknames from the registry and set them in the next column. Adding the contact works fine, but it won't set the nickname text. I've checked the value of nickname and it is correct, it's just the function failing for some reason (Only reason in documentation is that the window may have already closed, but it hasn't)

Please help, it's driving me mad :(

code:
for (var objSubKey in objSubKeys){
                    nickname = Registry_GetKeyValue(HKCU, 'Software\\Patchou\\Messenger Plus! Live\\GlobalSettings\\Scripts\\myScript\\Settings\\'+Messenger.MyUserId+"\\"+objSubKey, "Nickname")
                    nick.LstView_AddItem("Contacts", findEmail(objSubKey), 0, nick.LstView_GetCount("Contacts"));
                    nick.LstView_SetItemText("Contacts", nick.LstView_GetCount("Contacts"), 0, nickname);
        }

This post was edited on 09-19-2007 at 07:30 PM by Spunky.
<Eljay> "Problems encountered: shit blew up" :zippy:
09-19-2007 07:27 PM
Profile PM Find Quote Report
markee
Veteran Member
*****

Avatar

Posts: 1622
Reputation: 50
36 / Male / Flag
Joined: Jan 2006
RE: [?] LstView_SetItemText not working
You are trying to set the text of the next on in the list which doesn't exist yet.  After you use LstView_AddItem, in the next line the LstView_GetCount is increased by 1 and therefore doen't have the same index.  You can either minus one off of that in the SetItemText line, or you can just use the return value of the AddItem line and you should be fine.

Edit: also you don't need those last 2 parameters in the AddItem line as it will be added to the end of the list anyway and your itemData doesn't have any real purpose.

This post was edited on 09-20-2007 at 12:31 AM by markee.
[Image: markee.png]
09-20-2007 12:29 AM
Profile PM Find Quote Report
Spunky
Former Super Mod
*****

Avatar

Posts: 3658
Reputation: 61
36 / Male / Flag
Joined: Aug 2006
O.P. RE: [?] LstView_SetItemText not working
Minus 1 didn't work for some reason... Only about 5 or 6 contacts out of the list came up with the name... It's strange that they did when others didn't though. Using the returned index worked like a treat though :D Thanks. I couldn't understand because I've done this before somewhere.

"I may be an idiot, but there is one thing I'm not sir and that sir, is an idiot" :p
<Eljay> "Problems encountered: shit blew up" :zippy:
09-20-2007 12:35 AM
Profile PM Find Quote Report
markee
Veteran Member
*****

Avatar

Posts: 1622
Reputation: 50
36 / Male / Flag
Joined: Jan 2006
RE: [?] LstView_SetItemText not working
quote:
Originally posted by SpunkyLoveMuff
"I may be an idiot, but there is one thing I'm not sir and that sir, is an idiot"
OMG, I just watched that episode of family guy like 5 minutes ago.

Anyway, I'm glad that I could help you.
[Image: markee.png]
09-20-2007 11:47 AM
Profile PM Find Quote Report
Matti
Elite Member
*****

Avatar
Script Developer and Helper

Posts: 1646
Reputation: 39
32 / Male / Flag
Joined: Apr 2004
RE: [?] LstView_SetItemText not working
LstView_AddItem returns the index of the added item. Use it!!!
code:
var Index = nick.LstView_AddItem(...);
nick.LstView_SetItemText(..., Index, ..., ...);
Plus! Script Developer | Plus! Beta Tester | Creator of Countdown Live | Co-developer of Screenshot Sender 5

Found my post useful? Rate me!
09-20-2007 04:10 PM
Profile E-Mail PM Web Find Quote Report
Spunky
Former Super Mod
*****

Avatar

Posts: 3658
Reputation: 61
36 / Male / Flag
Joined: Aug 2006
O.P. RE: [?] LstView_SetItemText not working
quote:
Originally posted by Mattike
LstView_AddItem returns the index of the added item. Use it!!!
code:
var Index = nick.LstView_AddItem(...);
nick.LstView_SetItemText(..., Index, ..., ...);


Thats exactly what I did ;)
<Eljay> "Problems encountered: shit blew up" :zippy:
09-20-2007 04:42 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