Treeview scroll?

BlitzPlus Forums/BlitzPlus Programming/Treeview scroll?

gellyware(Posted 2004) [#1]
Is it possible to have a long list tree view with scroll bars? I cant seem to get it. Say the list is 1000 lines long, I need to have a scroll feature for this. Thanks.
Sorry so noob.


Mr Brine(Posted 2004) [#2]
the treeview gadget should auto create the sliders when your list either

a) becomes longer then the height of the treeview gadget (a vertical bar appears, rahh!)

b) becomes wider then the width of the treeview gadget, even if you only have one item with extremly long text string (a horizontal bar appears, rahhhh!)

regards

Mr Brine


gellyware(Posted 2004) [#3]
Mr. Brine, Could you show me a sample?

I created a long treeview (1000 lines) and it did not scroll.


gellyware(Posted 2004) [#4]
Seems I must be doing something wrong. The treeview demo under the Mak directory will create the scroll bars automatically. I will see what I am doing different.


Also there seems to be a bug or glitch. When you first run a program with a treeview, the little + sign does not appear. You have to click the root name first, then the plus sign appears. Why does this happen?


Beaker(Posted 2004) [#5]
Cos its being wierd. I've noticed it does that as well.


gellyware(Posted 2004) [#6]
Ok, I figured a way around the + sign not showing up.
Simply use the following after creating a node:

CollapseTreeViewNode node
ExpandTreeViewNode node

This forces the + sign to appear ;)


How does the icon feature work? Im trying this with no success.

TCS_tree_name = AddTreeViewNode ("<Click Me> Title", TCS_tree_root, appPath$+"images\toolbar_codingSet.bmp")



Does the icon have to be in the .ico format or something?


Mr Brine(Posted 2004) [#7]
Hi charles!

Ive had a blast at trying to get your 1000 items bug working on my machine and it has to be said I failed. Although I did get the little + symbol not appearing bug (this seems to of come about since iconstrip compatability was introduced). I did find an alternative method of getting the little + symbols to appear, and I suspect it will make the scrolly bar appear, its a bit dirty though. check it out:

; ------------------------------------------------------

Local w = CreateWindow("", 20, 20, 300, 300)
Local t = CreateTreeView(0,0,150,150,w)

q = TreeViewRoot(t)

For c = 0 To 1000

q = AddTreeViewNode("tv " + c, q)

Next

SetGadgetShape w,20,20,300,301
SetGadgetShape w,20,20,300,300

WaitKey

; ----------------------------------------------------------

the important thing to note about this code is that your resizing the parent object (the window), not the tree object (this did nowt on my machine) if this doesnt work I'd suggest either A)posting yer code on this forum or B) try recoding select parts of your program.

As for icon's with treeview gadgets try this

i = loadiconstrip(gfxfile) ; gfxfile = icon strip
setgadgeticonstrip t, i ; t = treeview gadget

then when your adding adding a node

addtreeviewnode "text", treeviewroot(t), 0

0 = index of icon, the icons width = icons height, the total no of icons = imagewidth / imageheight.

Regards

Mr Brine


gellyware(Posted 2004) [#8]
Reply, hey thanks Mr. Brine. Working like a charm.

I couldnt figure out the iconstrip stuff for the life of me :) thanks.