[Gambas-user] Control class missing a name and type property. ;)

Benoit Minisini gambas at ...2...
Tue Aug 26 21:39:05 CEST 2003


Le Mardi 26 Août 2003 17:59, Rob a écrit :
> On Tuesday 26 August 2003 10:10, R Onstenk wrote:
> > When I put a control on a form it's background is transparent.
> > (textlabel) When I set a background color on it it shows nice
> > but then I decide it must be the same as the form. How to set
> > background transparent again?
>
> Gambas uses Qt for all its controls, and Qt doesn't support
> transparent labels.  There are a number of workarounds for C++
> programmers in Qt but we don't know yet whether any of them will
> be suitable for inclusion in Gambas.  What looks like
> transparency when you initially place the control is just an
> illusion caused by the form background being the same color as
> the control background.

Making "transparent" labels is too much work at the moment, because QT, 
contrary to GTK+, has no widget without windows.

I admit that the behaviour of controls colors is not very clear in the IDE. I 
will change that.

>
> > When I can use For Each how do I determine which control I
> > have. In my example the ctrl should have at least a name
> > property. It should have also a property which provide the
> > Class or Type of the control.
>

> I agree, Gambas is missing those two properties in a big way.  As
> a workaround you can use the Tag property to store whatever
> identifying information you need.  Unfortunately, this is about
> the third or fourth workaround that uses the Tag property...

To know the type of an object, use Object.Type(...).

Controls don't have a name property because controls don't have names. This is 
an illusion from the IDE !

I know why people need control names, it is for doing awful things in general 
:-).

> pretty soon Benoit's gonna have to make Tag a variant so we can
> store user-defined classes in there, with all the stuff we're
> jamming into that one property ;)

Tag is already a Variant !

>
> Now, ContainerChildren is a collection so maybe there's a way to
> somehow get a list of keys out of it (they should be strings)
> and maybe those keys will be useful in identifying controls.  I
> haven't figured out how to do that though.

.ContainerChildren is not a true collection. It is an enumerable virtual 
class, in Gambas terminology.

>
> Neither of those problems has prevented me from doing what I need
> to do with Gambas, thus far.

So am I ! I hope I will succeed in changing old VB users habits :-)

-- 
Benoit Minisini
mailto:gambas at ...1...




More information about the User mailing list