[Gambas-user] GB3 Custom controls
Benoît Minisini
gambas at ...1...
Mon Nov 7 21:26:43 CET 2011
Le 07/11/2011 05:29, Bruce Bruen a écrit :
> I thought I had figured out all the secrets, but no.
>
> This is about custom controls (hereafter "CC") written in gambas.
>
> What I've found out so far
> 1) Declaring one of the hidden constants with the value set to the
> default causes problems, e.g. _IsContainer=False
Mmm. What are you talking about exactly ?
> 2) (Related) Don't use the _DrawWith constant without care as it will
> crash the IDE if the form is left open.
_DrawWith works only if you specify a control used by the IDE project
(it must be in gb.qt4, gb.qt4.ext, gb.form or gb.form.mdi).
> 3) The Controls directory containing the icons now has to go under the
> Project directory and migrating a GB2 project doesn't move them.
Indeed.
> 4) It would be really, really nice if IsContainer was a RO property
> exposed by all controls
To know if a control is a container, use the "IS" operator:
If MyControl Is Container Then ...
The difference is when a control actually inherits UserControl. It is a
container, but it must be used as a control.
So the test you need is:
If MyControl Is Container And If Not MyControl Is UserControl Then ...
> 5) It would be really, really, really nice if all controls had a
> AcceptFocus property (IDE visible) so things like Picture boxes can be
> skipped in custom navigation code
Normally PictureBox is a read-only control, so it should not get the
focus (do you use gb.qt or gb.gtk?).
DrawingArea has a "Focus" property. I admit it may be useful to put that
property in every control, but I'm not sure it is a good idea at the moment.
> 6) The IDE now makes testing a custom control library project really
> easy, except:
> a) it doesn't display the controls like they would appear in the
> finished product.
It should. Please give more details.
> b) the gb problem of having to reload the project if a new CC class
> is added still seems to exist.
What are you talking about exactly? Please give some details.
> 7) Issue # 123 GUI dependencies in library projects not exposing any gui
> dependency is a real pain.
Yes. Not fixed at the moment...
> ...and about a gazillion things about the differences in behaviour
> between gtk and qt4 (but they are not gambas problems).
Please report all of them as possible. The goal is to erase all these
differences as much as possible.
>
> So I have now partially converted my first level CC library from gb2 to
> gb3 and its real good!
> But what do I do now? How do I make it useable in the IDE?
> (Apart from 7 above I don't consider any of these to be gambas 3
> issues.)
>
> I have figured out that I can see the CC's in a form (*) in the IDE if I
> add the CC component to the IDE and recompile it (well actually, ran it
> inside itself). And they look real good and are displayed as they will
> in the finished product (allowing for the visual difference b/n QT4 and
> GTK). But the controls don't show up in the toolbox??
>
> (*) Done by importing a GB2 project "mocked up" to use the GB3 CC
> library control names
>
> I have tried sticking the library executable and the library.component
> file in /usr/local/gambas3 but that achieves nothing.
> I have tried sticking the library executable in /usr/bin with no joy.
>
> Would some of you nice people tell me what it is that I haven't done,
> please.
You must make a binary package of your component project. Normally this
package should install the component in the same place as the other
components located in the Gambas 3 source code, and should become as
usable as them.
Regards,
--
Benoît Minisini
More information about the User
mailing list