[Gambas-user] Custom Control

D. L. Fox ubuntu at ...2332...
Sun Nov 29 21:35:19 CET 2009


Benoît Minisini wrote:
> In Gambas 3, the /control directory must be put inside the "Project" section.

Okay, that worked. I was using the control directory automatically
created when I first created the project. Thanks.

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

I'm referring to code used when programming the component itself.

For example, in the component code:

Public Sub _new(lVal1 As Long, lVal2 As Long, Optional lVal3 As Long)

If I make the component and try to use it in a project, I have to also
pass the parent container name. So, if I use:

oVar = New ComponentName(lVal1, lVal2, lVal3, FMain)

It works fine. But if I try to leave out the *optional* argument:

oVar = New ComponentName(lVal1, lVal2, FMain)

I will get "Not enough arguments" from the IDE. If I try:

oVar = New ComponentName(lVal1, lVal2, , FMain)

I will get "Unexpected Comma" from the IDE. And, of course, if I pass 
NUll as the optional argument, it's the incorrect data type for the 
argument. I understand why I'm getting the messages I'm getting. I'm 
just asking is there any way to use an *optional* argument to the _new 
sub of a component.

This isn't something critical. This is just a personal project I chose
to do as an exercise, to get familiar with Gambas. I always do stuff
like this whenever I'm learning a new language or (in this case) IDE, etc.




More information about the User mailing list