I’m trying to populate a GraffitiTreeView and it’s nodes from an SqLite database and I’m having some trouble with the variables. This code throws an error: “winProject.popProject.SelectionChanged, line 46 Type mismatch error. Expected class GraffitiTreeViewNode, but got class GraffitiTreeViewNode”
I need to pull my node names from the database but obviously with Xojo not designed for dynamic variable names I can’t make each node name unique. That’s why I tried adding (0), (1), (2) to my variable but that doesn’t work. Am I wasting my time on this or is there a way to get around this? Maybe I’m just approaching it all wrong.
'Load the TreeView
Var projectNode as new GraffitiTreeViewNode(currentProject_Name)
projectNode.Expanded = true
projectNode.Tag = "project"
projectNode.Icon = currentProject_IconPicture
Var c As Integer = 0
Var childNode() As new GraffitiTreeViewNode("")
childNode.Expanded = true
query = "SELECT * FROM project WHERE project_id = '" + currentProject_ID.ToText + "' AND parent_id = 'project'"
result = db("SelectionQuery", "data").SelectSQL(query)
For Each row As DatabaseRow In result
childNode(c).Text = row.Column("name").stringValue
childNode(c).Tag = row.Column("id").stringValue
trvProject.AddNode(projectNode,childNode(c))
c = c + 1
Next
result.Close