PDA

View Full Version : Few questions w/ GuiTreeViewCtrl


KuJi
09-28-2006, 05:20 AM
1) How can I change the image selection?
2) How can I check which is the last node of a group? ( To give it a specific image )

Basically it opens a text file, and sends to client then loads it up into a treeview (works).. just can't get the two things I listed above to work =(

Admins
09-28-2006, 06:51 PM
You can either use icons (setIconSize() etc.), and you update them when you click the node or the node is expanded,
or you use the profile.bitmap, which can contain any number of sub images, separated by the color of the first pixel in the image (upper-left corner), check treeview_serverlisticons.png. The node then automatically chooses one of the images based on node.image, node.selectedimage, node.expandedimage and node.expandedselectedimage which specify the number of the image that should be used.

KuJi
09-28-2006, 09:09 PM
You can either use icons (setIconSize() etc.), and you update them when you click the node or the node is expanded,
or you use the profile.bitmap, which can contain any number of sub images, separated by the color of the first pixel in the image (upper-left corner), check treeview_serverlisticons.png. The node then automatically chooses one of the images based on node.image, node.selectedimage, node.expandedimage and node.expandedselectedimage which specify the number of the image that should be used.
Okay okay.. this is my problem now:


// Add Ranks
temp.tholder = temp.gangranks.savevarstoarray(true);
for (temp.I = 0; temp.I < temp.tholder.size(); temp.I++)
{
temp.hold = temp.tholder[temp.I];
if (temp.hold.substring(temp.hold.pos("=") + 1, -4) in client.gmembers)
{
with (Gang_Ranks_Tree.getnode(temp.tholder[temp.I].substring(temp.tholder[temp.I].pos("=") + 1, -4)))
{
image = selectedimage = 2;
}
}
}

Thing is.. I can't get the image to change =(. The variable for that.. for example would be KuJi but it's not the direct location and I've tried to think of 150 ways to get:
In Members:
1=KuJi (which is basically rank ids in the tree view or whatever)

In Ranks:
1=General Armii
1.1=General-Polkovnik
1.2=General-Lieutenant
1.3=General-Major

That would add me under General Armii which is fine. I just dont know how I can check the full length and use getnodebypath("STR", "STR"); or whatever =(.

If you have an idea to end up searching
5.4.4.8.2.6.8.3 (infinite really.. depends on how many ranks) to get the full paths.. please post it.

KuJi
10-01-2006, 06:05 PM
Bump =o

_Z3phyr_
10-31-2006, 02:16 AM
bump :O


I'm starting to learn this TreeView stuff too and I gotta know:


How do I add lists of things? addnode("Name of item here")? am I supposed to add them by root? It would be great if the wiki example could be the input for the intro pic on the top of the page...
( http://wiki.graal.net/index.php/Creation/Dev/Script/Client/GuiTreeViewCtrl )

Admins
10-31-2006, 03:12 AM
addnode() or addnodebypath() like in the example

_Z3phyr_
10-31-2006, 05:41 AM
Alright, and how would one be able to include a custom image alongside a node? HTML?

Admins
11-02-2006, 02:25 AM
alongside? You mean beside setting an unique icon?

_Z3phyr_
11-08-2006, 09:46 AM
Forget that question please. While I was unable to login to the g2k1 forums I eventually solved that matter.



New question:
How to use onSelect(qch, qch, qch)?

function GUIname.onSelect(?,?,?) {}

can someone give me a practical example for what to use in the function's arguments? I'm having trouble figuring out whether I should put a variable for the node's name, make a for loop and put the node's name in the 1st argument position and leave the others null, or what...


edit - can I say

function GUI_Name.onSelect(getselectednode(),null,null) {}

to make this work or should I use a variable and assign it to getselectednode()?

edit again - would I need to use the TreeViewCtrl name or the ScrollCtrl name?

((If I am way off then don't bother elaborating on why I'm wrong and just tell me the answer and call me stupid or something -ooc))