Re: Layout manager on a Rectangle



Ciao Emmanuele,

thanks for your suggestion about Rectangle, I missed that although I was keeping an eye about deprecated methods (d'oh!)

May I suggest, if possible, to explicitly mark Rectangle as deprecated class *on its own page*?
That is, here -- https://developer.gnome.org/clutter/stable/ClutterRectangle.html -- because the only way to see it's deprecated seems to be checking the deprecated class list in the documentation index.

In general, I would highlight more the deprecated features, classes or methods, but I guess the docs are auto-generated, so let's just ignore that if it is hard to do.

The incomplete tutorial - which I have to fix after this new discovery - should be available here: http://goo.gl/LkQUfy

**Any comment is highly appreciated** (I believe you can comment directly on the document if you have a Google Account).

Thanks for your help!

~Ale


On Wed, Oct 2, 2013 at 12:20 PM, Emmanuele Bassi <ebassi gmail com> wrote:
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]