[Gambas-user] Custom controls in gambas IDE

Bruce Steers bsteers4 at gmail.com
Tue Feb 23 15:21:39 CET 2021


>

> >
> > Thank you for your thoughts.
> > BruceS
> >
> >
> >
> > ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
> >
>
> A couple of points thatyou may wixh to consider.
>

Thank you bruce , I highly value your words of experience.

 1) You should only ;oad the custom control components used by the

> particular project that is active ibn IDE. This is the problem with not
> being able to unload them. If you open a different project in the same
> IDE window that uses different, possibly conflicting, custom components
> then you may get name clashes and thus IDE instability. Regardless of
> that you may also need to look at Preject/Refresh and the Git menu etc
> where the active project is trloaded.
>

I am not so sure the intention for my usage of this will affect that.
I am not really thinking (yet) about many unique controls made specifically
for one app.
My idea to to build my own little collection of controls that I will use in
everything.
Like the left or right handed checkbox with images for ticks.
the TickBox I know works, and in multiple interfaces as i had 2 or 3
running yesterday All using TickBox and all wth no conflicts.

This seems to be more like a "pseudo" component load. because Gambas loads
the control but does not use it in the interface as it is not a part of
gb.form.But then when I add a component to my project (Not via properties ,
by putting it's class file in my projects src dir) then when gambas tries
to check it's loaded controls for the _DrawWith = "MyCustomComponent" it is
able to find it.
It seems perfect to me, because it has not really added the custom control
to gambas I have to do that myself (it makes the custom control be part of
the app code and not any external component/library that needs installing)
thanks for the info though I will be careful with name conflicts and try to
make this work in a safe way.
It would be awesome if gambas could handle something like this.
At first i was modifying gb.form and actually adding the controls to gambas
fully but I think this way i am tricking the IDE into being able to find
the _DrawWith info without adding is not only about the bast i can do but
it's also ideally all i need.


2) have you considered custom control components with multiple controls?
>   I can't see your movie (eyesight problems not technical problems) So I
> cant see how you are specifying the component.
>

No worries allow me to explain..
In preferences i added a page with a Gridview and add/remove buttons, i can
add controls by dialog, I select the .gambas executable path.
Then next time gambas runs if it has files in the custom control list it
does the following...
Checks the custom control folder for a .hidden/info dir and creates one if
not there.
copies the projectfolder/.info file to projectfolder/.hidden/info/
controlname.info  (it does not display correctly without doing this)
then simply does Try component.Load(sExecutableNam)
that is all.
I have not tested it but i think as it has worked fine with the one control
inside the component it should be okay if there are others as all the
needed info is in the .gambas and .info file.
I think the only problem i can see is that i display the controls icon in
the prefs gridview if one exists in
projectdir/.hidden/control/lowercasecontrolname.png , that's going to fail
to find the icon if multiple controls exists that do not have the same name
as the exe. but a simple fix would be to have an icon for the component as
well as the controls inside it.

3) some controls (and therefore some custom controls based on them
> actually do do things inside the IDE form designer. For example the
> wizard control or consider a custom "sub-foorm switcher". Just
> suggesting you think about these things in your design of your IDE version.
>

aah yes thank you , I understand , that's the beauty of this method i
think, the "pseudo" add.
I cannot see how it will effect gambas as the only code relative to them it
the Component.Load() nothing else is done with them until the IDE searches
for a _DrawWith match in it's loaded controls db.
I am favouring this method as the best way to get the controls visible in
the IDE that effects gambas the least amount possible.


> 4) One thing I tried,almost succeeded and lost in a disk crash, was
> "custom editors for custom control propertied" . At the moment they have
> yo be included in the IDE code, for example the little popup editors
> used by the report controls. My idea was to have these property editors
> defined inside the cusyom control component. Yhus not disturbing the
> IDE. I was too busy trying to rebuild our dev box to try to recover what
> I had done (Always back up your dev versions frequently! is all I
> remember now.)
>

Ouch , yes we've all been there i guess :(
I lost 2 years worth of songwriting and a whole load of hand made software
once , was devastated :'(

Yes it seems with the way gambas renders controls the only way to get
custom ones to show is to add them at the base level :(
a control editor i do not think i need though as i already have gambas for
that :)
My only problem is not being able to see the controls in the IDE in the
designer as they should look.
My solution is clearly a bit of a hack but , , meh , i'll call it a
work-around ;)

I think it will be a plus if used wisely.
I'm hand building controls from scratch with little-to-no knowledge about
how to do so and have not broken gambas yet ;)
And the truth is development of the control i was working on, the TickBox ,
took a huge speed increase yesterday once i could see it in the ide.
It was a great help  (much like yourself sir :) )

>
> Anyway ymmv
> bruce
>

Thanks again bruce
Valued words of wisdom

Wishing well
BruceS
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20210223/4c20163e/attachment.htm>


More information about the User mailing list