About Tree List


kanber

Recommended Posts

Hello,

I am trying to do tree list. I write seq. like above.

private i

page.page_0.Component.TreeList.DeleteAllItems()

for(i=0, i<9, i++)

aux = page.page_0.Component.TreeList.InsertItem(i, 0, 0,i)

endfor

tree list like this;

1

2

3

4

5

6

7

8

but I want to do

-0

a

b

c

-1

d

f

g

etc.

How can I do?

Link to comment
Share on other sites

Unless you have the data in an array (which, depending on the app, I often recommend), you'll have to do it manually:

component.treelist.insertItem("-0",0,0,0)

component.treelist.insertItem("a",0,0,1)

component.treelist.insertItem("b",0,0,2)

etc.

I believe the the last parameter, Data, must be an unsigned integer, thus the reason I recommend putting the data in an array:

private treedata = {"-0","a","b",...}
for (private i = 0, i &lt; numrows(treedata), i++
   page.page_0.Component.TreeList.InsertItem(treedata[i], 0, 0, i)
endfor

Its not bad when you want a single level treelist, which is basically just a list. When you start actually creating a tree, it gets more complicated and you need to use more advanced structures to track everything. This is, unfortunately, the challenge of treelists in general and why there isn't a fancy properties window for treelists.

Link to comment
Share on other sites

You can't change the text color.

As for populating the tree list, is this going to be fixed data, or dynamic? Here's how you would do it fixed:

private parent = page.page_0.Component.TreeList.InsertItem("0", 0, 0, 0)

page.page_0.Component.TreeList.InsertItem("a", parent, 0, 0)

page.page_0.Component.TreeList.InsertItem("b", parent, 0, 0)

page.page_0.Component.TreeList.InsertItem("c", parent, 0, 0)

parent = page.page_0.Component.TreeList.InsertItem("1", 0, 0, 0)

page.page_0.Component.TreeList.InsertItem("d", parent, 0, 0)

page.page_0.Component.TreeList.InsertItem("e", parent, 0, 0)

page.page_0.Component.TreeList.InsertItem("f", parent, 0, 0)

etc.

Link to comment
Share on other sites

it is working thank you.

but I cant see full name. up and down you can control tree list. but I cant go right and left on tree list. what can I do? beacuse I will put on left side in my project. and I dont have enough place for tree list.

Can I change font size?

one more question. I want to use same tree list maybe on twenty pages. but it is not workin in different page. I paste and copy to another page. it is defult values. What can I do?

post-1585-1249470001_thumb.jpg

Link to comment
Share on other sites

There is no right and left scroll. You will need to make the list wider, or use abbreviated names.

If you want to use the tree on multiple pages, I would recommend putting it on its own page and overlaying that page with the other pages as we do in the AshlandWater sample. If you cut and paste, you will need to rename all the trees and duplicate all your population code.

Link to comment
Share on other sites

I can change. but it is not working like the AshlandWater sample. because in this example you have a button. and with change page function you can do. but in tree list I have double click event and I cant you change page function. I must use "page.strCurrentPage = "Page_2"" how can I do like sample in tree list?

Link to comment
Share on other sites

can you do tree list more useful.

1-change text colour

2-change font size

3-right and left scroll

I will do a project. and I want use tree list but in this position it is not so useful. can you do those things in new version of daqfactory?

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.