What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » HELP - "foreach" command!

HELP - "foreach" command!
Author: Message:
felipEx
Scripting Contest Winner
***


Posts: 378
Reputation: 24
35 / Male / Flag
Joined: Jun 2006
RE: HELP - "foreach" command!
quote:
Originally posted by SmokingCookie
Question 1: No, there is not a method to retrieve the current selection. You can, however, do this:

JScript code:
var SelectedItem = -1;
 
function OnWndTestEvent_LstViewClicked(PlusWnd,ControlId,ItemIdx) {
    if(ControlId == "vLstTest") {
        SelectedItem = ItemIdx;
        <do_other_stuff>
    }
}


Make sure though that you catch all selection-related events and set SelectedItem accordingly. They are:

  • OnWindowIdEvent_LstViewClicked();
  • OnWindowIdEvent_LstViewDblClicked();
  • OnWindowIdEvent_LstViewRightClicked();

A value of -1 means that no item is currently selected. That means, for example, there is only one item in the list-view control, and you click below that item.

Also, make sure to set SelectedItem back to -1 when the window is destroyed.

There's another way to get it working without dealing with a variable in those events :D

JScript code:
var LVM_FIRST   = 0x1000;
var LVM_GETNEXTITEM = LVM_FIRST + 12;
var LVNI_SELECTED = 0x2;
 
var SelectedItem = PlusWnd.SendControlMessage('vLstTest', LVM_GETNEXTITEM, -1, LVNI_SELECTED);

05-22-2009 05:15 PM
Profile E-Mail PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
HELP - "foreach" command! - by whiz on 05-21-2009 at 06:36 PM
RE: HELP - "foreach" command! - by SmokingCookie on 05-21-2009 at 07:35 PM
RE: HELP - "foreach" command! - by Spunky on 05-21-2009 at 07:38 PM
RE: RE: HELP - "foreach" command! - by andrewdodd13 on 05-21-2009 at 08:01 PM
RE: HELP - "foreach" command! - by SmokingCookie on 05-21-2009 at 07:41 PM
RE: HELP - "foreach" command! - by whiz on 05-21-2009 at 08:01 PM
RE: HELP - "foreach" command! - by whiz on 05-21-2009 at 08:17 PM
RE: HELP - "foreach" command! - by SmokingCookie on 05-22-2009 at 07:11 AM
RE: HELP - "foreach" command! - by whiz on 05-22-2009 at 12:49 PM
RE: HELP - "foreach" command! - by SmokingCookie on 05-22-2009 at 12:54 PM
RE: HELP - "foreach" command! - by whiz on 05-22-2009 at 04:17 PM
RE: HELP - "foreach" command! - by SmokingCookie on 05-22-2009 at 04:20 PM
RE: HELP - "foreach" command! - by whiz on 05-22-2009 at 05:07 PM
RE: HELP - "foreach" command! - by matty on 05-22-2009 at 05:12 PM
RE: HELP - "foreach" command! - by felipEx on 05-22-2009 at 05:15 PM
RE: HELP - "foreach" command! - by whiz on 05-22-2009 at 07:06 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