Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   A couple question about GuiTreeViewCtrl (https://forums.graalonline.com/forums/showthread.php?t=134258737)

DustyPorViva 04-12-2010 05:55 AM

A couple question about GuiTreeViewCtrl
 
1) Can I collapse all nodes? For large trees it's annoying to have them all expanded when the tree is created. I tried:
PHP Code:

with (addnodebypath(i.name,"/")) {
  
image selectedimage 2;
  
expanded false;


But that didn't do anything. I even looped through all the nodes and used 'expanded = false' but still no luck

2) Can I delete a node?

3) How would I go about setting a custom image for a node, instead of the predefined ones?

Gambet 04-12-2010 07:16 AM

Interestingly enough,

PHP Code:

function Test_Tree.onExpand() {
  
player.chat Test_Tree.expanded;


and

PHP Code:

function Test_Tree.onFold() {
  
player.chat Test_Tree.expanded;


both return true, which doesn't really make sense when folding a node. Also, if you try:

PHP Code:

Test_Tree.expanded false

then the entire tree disappears, which would appear to be a bug unless it isn't intended to be used this way.

coreys 04-12-2010 07:20 AM

1) If that doesn't work to collapse a node, then I don't think there is a way.

2) node_object.destroy() should work.

3) You should be able to do it the same way as with GuiTextListCtrl:
PHP Code:

with (addnodebypath(i.name"/"))
{
  
icon.clearall();
  
icon.drawimage(00"icon_image.png");


node_object.icon is a TDrawingPanel, same as rows in a GuiTextListCtrl.

DustyPorViva 04-12-2010 07:39 AM

Quote:

Originally Posted by coreys (Post 1568650)
1) If that doesn't work to collapse a node, then I don't think there is a way.

2) node_object.destroy() should work.

3) You should be able to do it the same way as with GuiTextListCtrl:
PHP Code:

with (addnodebypath(i.name"/"))
{
  
icon.clearall();
  
icon.drawimage(00"icon_image.png");


node_object.icon is a TDrawingPanel, same as rows in a GuiTextListCtrl.

I'll admit I didn't try destroy(), so I'll test that out.

Also, I did try icon.panelstuff() to no avail. I'll give it another try, though.

DustyPorViva 04-12-2010 08:37 PM

Ya, icon.xxx() doesn't seem to be working :(

edit: nevermind, I just had to seticonsize() first.

Programmer 04-12-2010 10:26 PM

For #1, instead of expanded, try using visible. It collapsed fine with visible.
For #2, use destroy().

DustyPorViva 04-12-2010 11:13 PM

visible worked great, thanks :)

All problems solved, I think... yey!


All times are GMT +2. The time now is 06:47 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.