[Gambas-user] Inconsistent initialization in controls: seems a little bug

Fabián Flores Vadell fabianfloresvadell at ...626...
Sat Sep 4 15:08:18 CEST 2010


2010/9/3 Benoît Minisini <gambas at ...1...>:
> Some explanations, because it seems that things are not clear for you:
>
> There is no difference in what you can do with the GUI editor and what you can
> do directly by code. The Gambas compiler just transform the GUI description
> into normal Gambas code.
>
> So when you put a Label inside a control, it generates something like that:
>
> <Label name> = NEW Label(<Label container>) AS "<Label event name>"
> WITH <Label name>
>  .Text = "<Label name>"
>  .MoveScaled(<X>, <Y>, <Width>, <Height>)
> END WITH
>
> *Very important!*: When a property has its default value, no code is
> generated.
>
> As soon as a control is created, it is automatically visible. *But*, at the
> moment, gb.qt4 assign an arbitrary size to the control, whereas gb.gtk has an
> internal system that shows the control only when a size has been attributed by
> code.

Thank for the explanation. I don't see here nothing that I missed.

> When I say that I prefer the gb.gtk behaviour, I mean I thought implementing
> the same system in gb.qt4 too.

That was what I understood.

> Why? Because changing a control property is generally heavier when it is
> already visible, because it must be refreshed. So it is perfectly logical that
> controls are not visible when created (which is what do *all* GUI toolkits).

Yes, that is logical. But isn't that Label remains with W=0 H=0
(making it invisible because have no dimensions) when a value is
assigned to its Text property. This is what I'm talking about.

> As for having "AutoResize = True" by default, it is not possible anymore, as
> it will break the existing code, because of the rule about default values of
> properties described above.

But, that supposed than someone will want recompile all your own
projects. Anyway, that's nothing than can't fixed by changing a line
of code. Isn't so?

However, this isn't a enough important topic.

-- 
Fabián Flores Vadell
www.speedbooksargentina.blogspot.com




More information about the User mailing list