Shoutbox

List-view groups - 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: List-view groups (/showthread.php?tid=95611)

List-view groups by SmokingCookie on 10-16-2010 at 12:24 PM

Hi everyone! Been absent for a couple of months due to school business, but now I'm back again.

Anyways, to the point: would it be possible for any of you guys to implement groups in Matti's List-view class? I've tried a couple of times, only to crash Messenger (A) :P


RE: List-view groups by matty on 10-16-2010 at 01:31 PM

Have you managed to get it working outside of his class?

If not have a look at this: http://www.winapizone.net/tutorials/winapi/listview/groups.php


RE: List-view groups by Matti on 10-16-2010 at 03:14 PM

My ListView class has a helper function to create an LVITEM (ListView.Helpers.LVITEM). This function is used when you add or change items in the list view.

My guess is that you'll need to add some code to that function to add support for groups. You'll have to add a parameter to the LVITEM function so you can pass in the wanted group ID. When this parameter is set, you need to write the value for iGroupId to the structure and add LVIF_GROUPID and LVIF_COLUMNS to the Mask. Of course, you'll also need to add and pass the group parameter to the functions using LVITEM (e.g. InsertItem).

I don't know how sorting and grouping would work together though. I'd recommend you try to get grouping to work without the ListView class and if that works, you could try to combine it with the ListView class.


RE: List-view groups by SmokingCookie on 10-16-2010 at 05:18 PM

@Matti: seems like I'm using an outdated version of your class? I copied it from Countdown live 2.1 and did some edits to it; I'll attach a ZIP file for ya :P

@matty: I've had no luck yet.. Here's my code (besides the class):

JScript code:
            MsgPlus.AddTimer("TmrLoadStuff",100);
            objPlusWnd.RegisterMessageNotification(WM_NOTIFY);
            MsgPlus.DisplayToast("",objPlusWnd.SendControlMessage("vLstContacts",LVM_ENABLEGROUPVIEW,true,0));
            var LVGROUP = Interop.Allocate(96);
            var Header = "First group!";
            var pszHeader = Interop.Allocate((Header.length + 1) * 2);
            with(LVGROUP) {
                writeDWORD(0,Size);
                writeDWORD(4,LVGF_HEADER | LVGF_GROUPID | 0x200 /* LVIF_COLUMNS */);
                writeDWORD(8,pszHeader.DataPtr);
                writeDWORD(12,pszHeader.Size);
                writeDWORD(24,101);
            }
            MsgPlus.DisplayToast("",objPlusWnd.SendControlMessage("vLstContacts",LVM_INSERTGROUP,-1,LVGROUP.DataPtr));
            var vLstContacts = new ListView(objPlusWnd,"vLstContacts");
            vLstContacts.InsertItem("Test item!",undefined,0,101);


Both toasts display a 1, indicating at least some success. But the result is an empty list view.
RE: List-view groups by SmokingCookie on 10-19-2010 at 10:24 AM

On a more related side note: as of now, I do have one working example at home (I'm at school now), I'll try to polish it a bit more and post it then.

Oh and it might be handy to split the DataType class bit off of this thread :P