[Gambas-user] Creating a Gambas component

Benoit Minisini gambas at ...1...
Mon Nov 24 20:52:11 CET 2008


On lundi 24 novembre 2008, dfuchs at ...2000... wrote:
> I have created a Gambas 2 project that contains some user controls, and
> I would like to make it a component.
>
>
>
> I have successfully compiled and installed the component, including its
> .component, .list and .info files in their proper places. So now I can
> insert the controls provided by my project into a form in the Gambas
> IDE. Still, some things do not work as I imagine they should, and I have
> some questions:
>

Hi,

You should use the developer mailing-list for development questions.

First, go read the "how to program components in Gambas" page on the wiki, you 
will find many answers there.

>
>
> - Can I make the IDE's property window display the public properties
> that are new with my controls, compared to UserControl? This would be
> most helpful, in fact, it was the main reason why I wished to make a
> component. I have seen that there is a hidden property named _Properties
> to every control class which obviously contains the names of the
> properties to display in the IDE. Can I assign values to this property
> in Gambas code, and will this have the desired effect?

Yes. The detailed answer is in the "how to" wiki page.

>
>
>
> - My controls do not draw themselves when inserted into a form in the
> IDE. They only draw a rectangle and the name of the control. Can I make
> them show their real look in the IDE? As for visualization (which works
> very well once a form containing my controls has been launched), my
> controls draw themselves through a DrawingArea that fills them
> completely.

You can't. The IDE can only display the real look of the controls it already 
uses. Otherwise, it just display a rectangle with the name of the control and 
its class icon.

For sure, it would be nicer to always see the real look of the control. But it 
would slow down the IDE a lot, as it would have to load some code each time a 
project uses a component, and unload it when the project is closed. What a 
mess...

>
>
>
> - In the toolbox, my controls are represented by tool buttons displaying
> only a question mark. Can I make the Gambas IDE's toolbox display my
> self-defined controls with an icon of my choice?

Yes. See the "howto".

>
>
>
> - In the "components" tab of the project properties dialog, my component
> is listed as "not finished but stable" but without a description. How
> can I make the description show?

Oops. This is a design bug: the default component names are stored in the IDE 
source code, so that they are translated with the other IDE strings. But this 
does not work with user-defined components! I will fix that.

>
>
>
> The project, including full HTML documentation in English, is to be
> found under www.sourceforge.net/projects/gambasmeasuring/
>
>
>
> Thanks for any help to come,
>
>
>
> Daniel Fuchs
>

Regards,

-- 
Benoit Minisini




More information about the User mailing list