What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » [?] Tree-view controls and item images

Pages: (2): « First [ 1 ] 2 » Last »
[?] Tree-view controls and item images
Author: Message:
SmokingCookie
Senior Member
****

Avatar

Posts: 815
Reputation: 15
27 / Male / Flag
Joined: Jul 2007
O.P. [?] Tree-view controls and item images
I'm working on something that makes handling tree-view controls a little easier. However, I don't see how to add images to an item.
04-29-2010 02:53 PM
Profile PM Find Quote Report
Matti
Elite Member
*****

Avatar
Script Developer and Helper

Posts: 1646
Reputation: 39
28 / Male / Flag
Joined: Apr 2004
RE: [?] Tree-view controls and item images
Matty and I made a tree-view class some time ago. The code isn't very beautiful and properly could use a rewrite, but it should be readable enough to understand how it works.
Basically, to add an item you send a TVM_INSERTITEM message with a TVINSERTSTRUCT. To change an item you send a TVM_SETITEM message with a TVITEM structure.

.txt File Attachment: TreeView.txt (12.06 KB)
This file has been downloaded 116 time(s).
Plus! Script Developer | Plus! Beta Tester | Creator of Countdown Live | Co-developer of Screenshot Sender 5

Found my post useful? Rate me!
04-29-2010 05:25 PM
Profile E-Mail PM Web Find Quote Report
SmokingCookie
Senior Member
****

Avatar

Posts: 815
Reputation: 15
27 / Male / Flag
Joined: Jul 2007
O.P. RE: [?] Tree-view controls and item images
I've read your class hours ago, and I am afraid.. well.. ya know :p If I'd understood the image-handling thingy, I wouldn't have posted :P

This post was edited on 04-29-2010 at 05:32 PM by SmokingCookie.
04-29-2010 05:29 PM
Profile PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
36 / Male / Flag
Joined: Dec 2002
Status: Away
RE: [?] Tree-view controls and item images
Wow that is SO ugly... I can't believe we, at one point, wrote that...

This post was edited on 04-29-2010 at 05:35 PM by matty.
04-29-2010 05:33 PM
Profile E-Mail PM Find Quote Report
SmokingCookie
Senior Member
****

Avatar

Posts: 815
Reputation: 15
27 / Male / Flag
Joined: Jul 2007
O.P. RE: [?] Tree-view controls and item images
Yeah.. Can't read it :P @Matti: think you need to check encoding etc. Or just pack it to a ZIP file :P
04-29-2010 05:35 PM
Profile PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
36 / Male / Flag
Joined: Dec 2002
Status: Away
RE: [?] Tree-view controls and item images
quote:
Originally posted by SmokingCookie
Yeah.. Can't read it :P @Matti: think you need to check encoding etc. Or just pack it to a ZIP file :P
Save the file as a JS file and open it in Notepad++. It is a unicode file.
04-29-2010 05:36 PM
Profile E-Mail PM Find Quote Report
SmokingCookie
Senior Member
****

Avatar

Posts: 815
Reputation: 15
27 / Male / Flag
Joined: Jul 2007
O.P. RE: [?] Tree-view controls and item images
Well, I've got the file here as well, as Countdown Live uses it, and I use CDL :P

But that doesn't really solve my problem :P

This post was edited on 04-29-2010 at 05:41 PM by SmokingCookie.
04-29-2010 05:40 PM
Profile PM Find Quote Report
Matti
Elite Member
*****

Avatar
Script Developer and Helper

Posts: 1646
Reputation: 39
28 / Male / Flag
Joined: Apr 2004
RE: [?] Tree-view controls and item images
Then what is the problem you're having? Do you need to add a new image to the tree's image list or something? Or do you have trouble finding what arguments to pass to those functions?
Plus! Script Developer | Plus! Beta Tester | Creator of Countdown Live | Co-developer of Screenshot Sender 5

Found my post useful? Rate me!
04-29-2010 05:50 PM
Profile E-Mail PM Web Find Quote Report
SmokingCookie
Senior Member
****

Avatar

Posts: 815
Reputation: 15
27 / Male / Flag
Joined: Jul 2007
O.P. RE: [?] Tree-view controls and item images
I've got absolutely no idea how to add an item with an image. So that's pretty much both.
04-29-2010 05:52 PM
Profile PM Find Quote Report
Matti
Elite Member
*****

Avatar
Script Developer and Helper

Posts: 1646
Reputation: 39
28 / Male / Flag
Joined: Apr 2004
RE: [?] Tree-view controls and item images
Well, first of all you'll need to put some images in the tree view's image list. In order to prevent Plus! from messing up the image indexes, I always prefix the image ID with the image position.
XML code:
<Control xsi:type="TreeViewControl" Id="MyTree">
    <Position Left="10" Top="10" Width="100" Height="150" />
    <Images>
        <NormalIcons>
            <Image Id="01-folder">
                <Name>icon-folder</Name>
            </Image>
            <Image Id="02-file">
                <Name>icon-file</Name>
            </Image>
        </NormalIcons>
    </Images>
</Control>

Now to add an item, you can use TreeView::addItem.
Javascript code:
var tree = new TreeView(PlusWnd, "MyTree");
var parentNode = tree.addItem("My folder", 0, 0);
var childNode = tree.addItem("My file", parentNode, 1);

This will add a root node with a child node to the tree. The root node will have a folder icon and the child node will have a file icon (assuming that you have those images in your script).
Plus! Script Developer | Plus! Beta Tester | Creator of Countdown Live | Co-developer of Screenshot Sender 5

Found my post useful? Rate me!
04-29-2010 06:12 PM
Profile E-Mail PM Web Find Quote Report
Pages: (2): « First [ 1 ] 2 » Last »
« 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