[Gambas-user] Could someone give me a brief explanation of parents and kids in this example

Jb Skaggs jbskaggs42 at ...626...
Wed May 14 17:57:58 CEST 2014


In the treeview example I would like to understand the parent and kids aspects:

Public Sub Button1_Click()

  Dim sIcon As String
  Dim sParent As String

  If Textbox1.Text <> Null Then
    If RadioButton1.Value Then
      sIcon = "Male.png"
    Else
      sIcon = "Female.png"
    End If
    'Gets the parent item: the current item, or nothing is the treeview is void
    sParent = TreeView1.Key
    'Now we will add a new entry with a key and a name of what was in
the text box
    'We will place it as a child of the currently selected entry
    TreeView1.Add(Textbox1.Text, Textbox1.Text, Picture[sIcon],
sParent).EnsureVisible
    TreeView1.Item.EnsureVisible 'This will make sure that the item we
just added to the list is in the visable area of the control.
(Scrolling if necessary)
    TextBox1.Text = "" 'This empties out textbox
    RefreshInfo ' This will update our label and reflect the new number of kids
  End If
End


My understanding was that a kid or child was a copy or instant of the
parent but I don't know if this is true in Gambas-  so I would like to
understand what actually happens when something is a parent and child.
 Thank you. Jb Skaggs




More information about the User mailing list