[Gambas-devel] Creating a Control

John Leake jleake at ...741...
Mon Sep 8 17:43:39 CEST 2014


> Yes, the link is actually about writing an own component (shared library)
> but it's also cited frequently as a resource of how to implement your own
> (graphical) control. Both topics are technically independent of one another,
> i.e. you don't need to create a component to add new controls to your
> project and new components don't always contain controls. But typically (?)
> they're used together.

> You only need to check this box if you are
>   a) exploring how to integrate your own component into other projects or
>   b) seriously writing a useful component.
> 

I have several components/controls I wish to create and share.  So I am
trying to keep it simple. i.e. create a togglebutton from an existing
control and see if I can use it just like the original before
overriding/adding functionality and combining it with other controls.

> Look at it from a developer's point of view: what would it take to collect
> all custom controls from projects the user might have? It would need to scan
> at least the entire home directory of the user (not all projects containing
> custom controls might have ever been opened by that IDE; you could have just
> downloaded them, e.g.). No sane program would do that on each startup.

I am a developer and have been for 30+ years and would like to
contribute to this fantastic IDE.  Turning this point on its head then
we should be thinking from the perspective of a users point of view.

If I am in the IDE and have created a component (from an existing
component) then the IDE knows all about my project and where it is.
After all it remembers my IDE preferences.

> The Gambas IDE requires *you* to put your stuff into one of the (very) finite
> number of standard locations so that it can be found. One of those standard
> locations is the project's source code directory and /usr/lib/gambas3 for
> components.

How is a user supposed to know that ? Another problem with this point of
view is the coupling that you create between how developers implement
the IDE and the documents that the user reads in order to use the IDE.

If the user chooses to publish (make part of Gambas) a control then the
IDE can choose where it should go.

> 
> [ But note (again?): I don't really work with custom (not in the official
>   source tree) components and libraries. I just don't create them because my
>   projects are simple and heterogenous enough to be self-contained. Almost
>   all my experience here is from reading the docs and occasional mails about
>   it. I just answer because I'm afraid Benoit is too busy and so nobody else
>   will respond.
> 

I appreciate your responses and your time very much.

>   Maybe I should stop doing that so that others don't think you are already
>   "being treated"? Or maybe you should write to gambas-user where the chances
>   are higher that people with custom components/libraries listen. Ceterum
>   censeo Carthaginem esse delendam ;-) ]

I have posted a similar question on gambas-user.  I would like to
contribute to the development of the IDE. Because I am a gambas newbie I
can see what will trip newcomers up and turn them away, (It nearly
happened to me).

> Yes, this "publish" function is the "cp" program :-) Except there is no
> great global "pool" of classes when using "cp".

I will have a look at it.

> 
> If you miss an integrated function for this way of organisation, you are
> very welcome to implement it once you can imagine how to do it.
> 

That is what I am trying to do.

>> How can I use my new local control an new projects ?
>>
>>> If you want to use it in other projects, you can
>>>  - create a component, install it and plug it in (Project -> Properties ->
>>>    Components),
>>
>> Sorry I cannot find instruction for this.
>>
> 
> I think your next mail addresses this...
> 
>> w.r.t. 5) From the docs "Each control must have an icon that will be
>> displayed
>> in the IDE control tool box.".
>>
>> Shouldn't the default be images from the original control ?
>>
> 
> So you suppose that if there is no picture to symbolise a control, the
> parent class should be drawn. 

If a user creates a new ToggleButton from the Gambas ToggleButton and
does not change it then it should behave just like the original with the
exception of its name.

I would agree. But maybe this logic is just
> not integrated yet (I think it would require to extract files from other
> components). Let's (implicitely) ask Benoit.

Again that is what I am trying to do.

One general point about drag and drop GUI design is that the holy grail
would be for all the components an app would require would already exist
and all a user needs to do is wire them up and integrate some
application domain logic and we all sail into the sunset.

Clearly one cannot anticipate the shape and form of these components
ahead of time.  Bloat sets in and that is not acceptable these days.  If
however it is made trivial to combine existing low level controls to
create new ones then we are getting somewhere.


Best regards,
John Leake




More information about the Devel mailing list