[Gambas-user] new font class behavior is broken

Benoit Minisini gambas at ...1...
Sun Apr 4 22:42:26 CEST 2004


On Sunday 04 April 2004 22:32, Rob wrote:
> On Sunday 04 April 2004 11:30, Benoit Minisini wrote:
> > To allow Control.Font.Bold = TRUE changing the control font in
> > Gambas AND Control.Font returning a Font object, I had to
> > implement a special support in the class routines of the
> > interpreter. And the Font class was the sole one in this case
>
> Why not just make a virtual class .ControlFont which is a
> subclass of Font, and which itself has a property called Font
> which returns the control's non-virtual Font object?
>
> Rob
>

It is not a matter of virtual class. The problem is that the old Font knew 
which control it was related to.

But your suggestion gives me an idea: storing in Font objects returning by 
Control.Font a reference to the control it comes from. The positive point is 
that you will be able to do Control.Font.Bold = TRUE. The negative point is 
that if you forget to release a reference to this font object, then the 
control object will never be destroyed.

Regards,

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




More information about the User mailing list