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

Rolf-Werner Eilert eilert-sprachen at ...221...
Wed May 14 18:35:01 CEST 2014



Am 14.05.2014 17:57, schrieb Jb Skaggs:
> 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
>


Errr - this is the TreeView, not inheriting (OOP):

Parent1
|--Child1 to Parent1
|--Child2 to Parent1
Parent2
|--Child1 to Parent2
    |--Child1 to (Child1 to Parent2)*
|--Child2 to Parent2

* = Parent to it

Or did I get you completely wrong? ;)

Regards
Rolf




More information about the User mailing list