[Gambas-devel] Re: [Gambas-user] Developing a gambas component using gambas.

Benoit Minisini gambas at ...1...
Wed Oct 5 21:45:05 CEST 2005

On Tuesday 04 October 2005 13:01, Dani Santos wrote:
> Hi all.


> I'm trying to make a gambas component using gambas (C/C+ is too much to
> me).

So you should write this mail on the devel mailing-list...

> I followed J.L. Redrejo advices and donloaded the gambas-gb-form source
> code to see how is it built. I have made several progress but I've got
> some questions to make:
> - ¿How do I asign the icon that is shown in the gambas-toolbox to my
> gambas component?

The icons are hard-coded in the IDE at the moment. They should be put outside, 
in a directory like /usr/share/gambas2/controls for example.

> - ¿How can I have a preview of the control I'm making in design-time? I
> mean with this that I only see a slashed rectangle, but I don't see the
> components it is made with. For instance, if I use the gb.form component
> in a application and I put a ColorChooser component in a form, I can see
> how it is perfectly with all it's controls, but not so with my
> component.

You can see a preview only if the IDE uses the component the control belongs 
to. Otherwise, you only see a dashed frame. So if your component is not 
gb.qt, gb.form or gb.qt.ext, you will never see it!

I'm thinking about a way to specify a standard gb.qt control for drawing the 
real control, with a "_DrawWith" property or something like that.

> Finally, this is the script I use to add my component to the list of
> components of gambas. It's only for the test phase. ¿Is it correct? ¿Is
> there a betterway?
> daniel at ...352...:~/srcGambas/gb.dycontrols$ cat instala-componente.sh
> #!/bin/sh
> case $1 in
>    -a)
>       cp -vf gb.dycontrols/gb.dycontrols.* /usr/lib/gambas2
>       chmod 644 /usr/lib/gambas2/gb.dycontrols.component
>       chmod 755 /usr/lib/gambas2/gb.dycontrols.gambas
>       cp -vf
> gb.dycontrols/.info /usr/share/gambas2/info/gb.dycontrols.info
>       cp -vf
> gb.dycontrols/.list /usr/share/gambas2/info/gb.dycontrols.list
>       break;;
>    -d)
>       rm -vf /usr/lib/gambas2/gb.dycontrols.component
>       rm -vf /usr/lib/gambas2/gb.dycontrols.gambas
>       rm -vf /usr/share/gambas2/info/gb.dycontrols.info
>       rm -vf /usr/share/gambas2/info/gb.dycontrols.list
>       break;;
> esac
> - You must be logged as root to use the script:
> - ./instala-componente.sh -a -> Installs the component.
> - ./instala-componente.sh -d -> Removes the component.

You can't do that. Components written in Gambas must be inserted into the 
'comp' directory inside the source tree, and you must update the ORDER file 
in it, to tell which order must be used when compiling these components.

So when your component is finished, send it me and I will add it into the main 
source tree. Like other components written in C/C++.

I didn't have the time to document all that yet... Sorry :-)

> Regards.


Benoit Minisini

More information about the Devel mailing list