[Gambas-user] Re: Treeview and other Questions

ron ronstk at ...239...
Fri May 5 17:57:01 CEST 2006


On Friday 05 May 2006 15:49, KARL WHEELER wrote:
> Thanks Ron, I am such a noob - sorry.
>  
>  I was checking the online help, it did'nt occur to use the examples :)
>  
>  OK I've got this figured ( i think ), but is it possible to take the 'treeview.item.key' 
>  and use it to show a form. I was hoping to set the key to be the form name and then use 
>  this with .show to open the form, but I keep getting an error  
>  
>  Thanks
>  
>  Karl
>  
I can not do nothing whithout get the error message excact and the
gambas version you use.
 
However next can help a bit.
Take care that every time you add something to a treeview the key must be unique.

A very simple way to use for example is
 Treeview1.Add( Treeview1.Count & "=" & YourNotUninqueName , TheTitle )

in the TreeView1_Select()
 Dim k as string[]
 k=Split( TreeView1.Key , "=" )

now you can use k[1] as name for the form to open

normal you use
 dim hForm as YourForm 
 hForm = NEW YourForm
 hForm.Show

but dynamic you need 
 dim hForm as Form ' the real form is unknown
 hForm = New ( k[1] )  ' k[1] between pharenthesis !
 hForm.Show()
  


See in the Help the Language section about NEW and New()
  hButton = New("Button", hParent)
  'has exactly the same effect as: 
  hButton = NEW Button(hParent)


Ron




More information about the User mailing list