Shoutbox

[Thx!] PlusWnd1.LstView_SetSelectedState() - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: [Thx!] PlusWnd1.LstView_SetSelectedState() (/showthread.php?tid=72970)

[Thx!] PlusWnd1.LstView_SetSelectedState() by Flash on 03-24-2007 at 04:31 PM

its possible when i use the PlusWnd.LstView_SetSelectedState(...) cmd

the listview automatic scroll down on the select item??

if i select the item 10 i not see the selection, i want to move the scrollbar for see select item


RE: [LittleHelp] PlusWnd1.LstView_SetSelectedState() by CookieRevised on 03-25-2007 at 01:09 AM

It isn't done automatically.

You need to send a message to the listview to let the list jump to the item so it is visible.

This can done by sending the windows message constant LVM_ENSUREVISIBLE to the listview.

where the two parameters are:
- i: The index of the list-view item.
- fPartialOK: A value specifying whether the item must be entirely visible. If this parameter is True, no scrolling occurs if the item is at least partially visible.

Thus:
PlusWnd.SendControlMessage(MyControlId, LVM_ENSUREVISIBLE, i, fPartialOK)

eg:

code:
MyWindow.SendControlMessage("MyListViewID", /* LVM_ENSUREVISIBLE */ 0x1013, 5, False)
this makes that the listview with ID "MyListViewID" on the window object MyWindow will make the 6th item (first item is item index 0) entirly visible.

PS: that  '/* something */'  isn't needed, it is just an inline comment to make it clear what the number stands for.
RE: [LittleHelp] PlusWnd1.LstView_SetSelectedState() by Flash on 03-25-2007 at 06:09 AM

Thx cookie that work fine ;)

code:
var id = ListViewAddRow(PlusWnd1,'ListSecs', Array('',inc+ ' - ' +p1,p2))
                if (p3 == 1) PlusWnd1.LstView_SetItemIcon('ListSecs', id, "ImgBusy", true);
                if (num == o) {
                    select = 1
                    PlusWnd1.LstView_SetSelectedState('ListSecs',id,true);
                    PlusWnd1.SendControlMessage('ListSecs', /* LVM_ENSUREVISIBLE */ 0x1013, id, false)
                }