[Gambas-user] Events and attach

Benoit Minisini gambas at ...1...
Sat Jan 14 08:24:46 CET 2006


On Saturday 14 January 2006 02:24, Marco Gusy wrote:
> Alle 13:01, venerdì 13 gennaio 2006, Benoit Minisini ha scritto:
> > You can create your own control by inheriting UserControl or
> > UserContainer
>
> in
>
> > gambas 1.9.x. Examples are located in the source code of the gb.form
> > component.
>
> Ok, I studied it more. If i'm not wrong the best way is to create a class
> (the class the end user will istantiate into the form) which inherits
> usercontrol. Inheriting usercontrol is mandatory because includes the
> drawing area, right? Into this class I add my code and define in it a form
> (or other object/s). The class would listen to form/objects events, while
> the end user would receive only the events the class exports.
> Am I right?
>
> Thanks again
>
> Marco
>

The problem is more complex...

UserControl is not a DrawingArea, it is a Container that does not expose 
Container properties to the IDE. It is a Container, because usually you want 
to make a new control by mixing already existing one. But if you want it to 
look like a control, you must only expose control properties, not container 
ones.

Otherwise, you have a UserContainer control. It is exactly the same thing than 
UserControl, except that: the Container properties are exposed (you want to 
create a true container in Gambas), and that there is a special property 
(named... Container) that tells Gambas which control acts as the real 
container.

Maybe I'm not very clear :-) But you can look in gb.form again to see how I 
used them.

Regards,

-- 
Benoit Minisini





More information about the User mailing list