[Gambas-user] Custom Control

Benoît Minisini gambas at ...1...
Sun Nov 29 19:32:33 CET 2009


> Kadaitcha Man wrote:
>  > You don't need to know C. Simply inherit the control in
>  > Gambas code then wrap your methods and properties around it.
> 
> DOH! I should have thought of that. <insert lame excuse here> Thanks!
> 
> Either I've found a bug, or I'm not doing something right. The doc says:
> 
> "To provide the icons of your component controls, you must create a
> /control directory at the root of your project, and put one PNG file for
> each control icon in it.
> 
> The name of a control icon must be the class name of the control in
> lower case with the .png extension."
> 
> I tried that but it just shows a black question mark in the IDE panel
> when I load the component. The component itself works as expected. Are
> there any other requirements needed of the icon? I'm currently using a
> 32 x 32 PNG file, named in all lowercase the same as the component. I'm
> running Gambas3 on Ubuntu 9.10.
> 

In Gambas 3, the /control directory must be put inside the "Project" section.

> Am I allowed to use *optional* arguments in the _new sub of the
> component? Or am I not suppose to pass arguments to _new?
> 

Arguments passed to the constructor are consumed by each inherited _new 
methods in reverse order. If you use optional arguments in inherited 
constructors, they must be provided too.

> I know I have to pass the name of the parent container when I use it at
> runtime. I currently have it working using arguments in the _new sub and
> passing the parent name at the end of the argument list. However, the
> last argument I was using is *optional*. If I leave the optional
> argument empty, the IDE says the parent name is 'unexpected'. If I pass
> Null as the optional argument just prior to the parent name, naturally
> it's the wrong data type for the argument. I'm probably missing
> something obvious again. Go ahead and smack me.

Please provide the details of what you have done, and maybe I will tell you.

Regards,

-- 
Benoît Minisini




More information about the User mailing list