[Gambas-user] Re: Treeview data

Benoit Minisini gambas at ...1...
Sun Feb 26 00:36:11 CET 2006


On Saturday 25 February 2006 20:00, GuruLounge - MailLists wrote:
> That worked!  You just have to add the event subs yourself, e.g.
>
> public sub mytree_click()
>
> 	print "tree clicked!"
>
> end
>
> Another question is how do you create this object on a form but from a
> module -- as I generally create the majority of my procedures in a main
> module or other modules.  I only code in forms when necessary.

By default, an object sends its events to the object where it is created. When 
the object is created inside a static procedure or function, then the events 
are sent to static event handlers of the class.

To override this default behaviour, use the Object.Attach() method.

You should read the documentation about NEW in the wiki.

>
> I can create the treeview on a form via a module but I can't access any
> events and can only access properties for the treeview from the module,
> not the form.

???

>
> And most importantly, how do I create a new property (string or
> otherwise) for a specific key, not just the treeview class itself.

You can't do exactly the same thing as the native TreeView class, that returns 
a "virtual" class when you use the array accessor. But you can implement your 
own method, like GetData(Key).

Regards,

-- 
Benoit Minisini





More information about the User mailing list