Guys,

again having trouble with my current project.
Can't tell when looping through a TreeViews Node Collection if the current Node has child nodes in the next level (my TreeView will have 3 levels of Nodes, all checkable)

here's what I tried (one of Shawns samples adapted a bit to simulate more than one level of Nodes, totally unstylish, what I can't find is in the comment in the only function of the script)

 Code:
Break On
global $l1, $l2
$= setoption("NoVarsInStrings","ON")
$System = CreateObject("Kixtart.System")

$f = split(readprofilestring(@scriptdir + "\Form.ini", "Form", ""),chr(10))

$Form = $System.Form()
$Form.Size = 640,480
$Form.Center()

$Form.ToolGroupBox = $Form.GroupBox()
$Form.ToolGroupBox.Height = 30
$Form.ToolGroupBox.Dock = 1

$Form.StatusGroupBox = $Form.GroupBox()
$Form.StatusGroupBox.Height = 20
$Form.StatusGroupBox.Dock = 2

$Form.TreeView1 = $Form.Controls.Add("TreeView")
$Form.TreeView1.Width = $Form.ClientWidth / 4
$Form.TreeView1.Dock = 3
$Form.TreeView1.ShowLines			= 1
$Form.TreeView1.ShowPlusMinus		= 1
$Form.TreeView1.ShowRootLines		= 1
$Form.TreeView1.CheckBoxes			= 1
$Form.TreeView1.OnClick             = "treeView_Click()"
$Form.TreeView1.OnAfterSelect		= "treeView_Click()"

$Form.Splitter1 = $Form.Splitter()
$Form.Splitter1.Dock = 3

$Form.TextBox1 = $Form.TextBox()
$Form.TextBox1.Multiline = 1
$Form.TextBox1.Dock = 5

for each $e in $f
	if $e
		$l1 = $Form.TreeView1.Nodes.Add($e)
		$l2 = $Form.TreeView1.Nodes(ascan($f,$e)).Nodes.Add($e+" - " + readprofilestring(@scriptdir + "\Form.ini", "Form", $e))
	endif
next

$Form.Show
While $Form.Visible
 $=Execute($System.Application.DoEvents)
Loop

Exit 1

function treeView_Click()
	dim $checkedNodes
	for $i = 0 to $Form.Treeview1.Nodes.Count - 1
		if $Form.Treeview1.Nodes($i).checked
			$checkedNodes = $checkedNodes + $Form.Treeview1.Nodes($i).FullPath + @crlf
		endif
		; here would go something like
		; if $Form.Treeview1.Nodes($i).HasChild ..
	next
	if $checkedNodes
		$Form.TextBox1.Text = $checkedNodes
	endif
endfunction


attached is the file I used to get input for the TreeView..

As you will see only the first level of checked Nodes will get displayed right of the splitter \:\(



Attachments
Form.ini (444 downloads)
Description:




Edited by Jochen (2012-04-10 03:43 PM)
_________________________