[Gambas-user] GB3 Custom controls

Bruce Bruen bbruen at ...2308...
Sun Nov 13 06:46:57 CET 2011


On Sun, 2011-11-13 at 03:01 +0100, Benoît Minisini wrote:

> Hi Bruce,
> 
> I took at a look at your code. You made a big mistake by making your 
> controls inherit UserContainer, whereas they are not containers. Which 
> makes the IDE mad when you want to use _DrawWith or some other properties.


Yes, that makes sense. 


> They must inherit UserControl. 


I used UserContainer in gb2 for some reason lost in the mists of time, I
think it was to do with a "handy" property in the UserContainer that was
not in UserControl.  

I thought that maybe the reason has "gone away" now so I retried the
LabelTextBox inheriting UserControl.  However, I have struck a problem -
I can't seem to restrict the Height value if my control is used inside a
container that enforces it's own height.  For example, if the
LabelTextBox is inside a HBox it's height will expand to the HBox
height.  I realise that this is what is "supposed to happen" but it's
not what I "want to happen".

I have attached two screen shots showing my problem.

I don't know why my intentions work when inheriting UserContainer and
not when inheriting UserControl.  I'll look into this further this week
to see if I can characterise it properly.


> Or maybe I didn't understand what you 
> want to achieve at all!


The intent is to give my two volunteer designers/coders with
"simplified" controls that:
- behave in terms of "navigation" the same way in both QT4 and GTK+
- provide some extra properties (e.g. the label) that can be set in the
IDE and thus reduce both design and coding time
- subsume the various native events (Activate, Click, Change etc) into a
single "Changed" event that is only raised when the user has finished
altering the value content of the controls
- ( and at stage two), to build some "data aware" controls - like
gb.gb.form - but which will work with some standardised "business
object" classes.

regards
Bruce
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Container.png
Type: image/png
Size: 27438 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20111113/0d0bb9ec/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Control.png
Type: image/png
Size: 24019 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20111113/0d0bb9ec/attachment-0001.png>


More information about the User mailing list