Re: Layout manager on a Rectangle



hi;

On 2 October 2013 10:32, Alessandro Re <ale ale-re net> wrote:

Oh, and I am writing a tutorial as I go, so, if you want, I can submit it
for a review.

thanks, that would be very much appreciated.

I was experimenting with layout managers, and I tried to create a simple
button in this way:

1. created an Actor()
2. created a Rectangle()
3. created a Text()
4. make Text and Rectangle child of Actor
5. set BinLayout() onto Actor.

And this seems to work fine. Then I tried without the Actor, placing the
Text directly on the Rectangle ( rect.add_child(text) ), using the BinLayout
( rect.set_layout_manager(BinLayout()) ), but without success: the Text
seems to be vanished, I can not see it (also tried with the show() method).

Clutter.Rectangle is a deprecated class, and should not be used in
newly written code. you can effectively replace it with a simple
Clutter.Actor with a background color, or (in case you need fancier
drawing features like borders or rounded corners) with a
Clutter.Canvas content.

I would not use a deprecated class in a tutorial either.

Can someone please explain me why it is so?
Maybe Rectangles are not made to have a layout manager?
Should I use always a third Actor for this kind of tasks?

the reason you don't see a child of a Clutter.Rectangle is that
Rectangle does not paint its children, for backward compatibility. you
can add children to it, but they will never be painted — unless you
subclass Clutter.Rectangle and override the `paint` virtual function.

again, I strongly encourage you not to use deprecated functionality,
especially when creating documentation.

I look forward to reading your tutorial!

ciao,
 Emmanuele.

-- 
W: http://www.emmanuelebassi.name
B: http://blogs.gnome.org/ebassi/


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]