Re: rounded rectangles problem

Jan Hudec wrote:

On Wed, Aug 10, 2005 at 13:56:18 -0400, James Muir wrote:
Hi All,

I'm trying to subclass Gnome2::Canvas::Shape to get a rounded rectangle. No success yet. I need to set the Bpath for the shape. As far as I can tell the pathdef can not be set up in INIT_INSTANCE as this is too soon and the properties have not been passed in. I'm not sure if it's OK to

So set it up in SET_PROPERTY. Whenever some of the properties affecting the
shape is set, look whether all the others are defined, and if they are, set
the shape. SET_PROPERY /is/ called for default values if not explicitly
specified, so you can be sure all the properties will be set before the
object is shown.

instantiate a pathdef inside my RoundedRect or not, and I'm not sure how to call set_path_def. I've seen in the Mup::ColorButton example that an event is used to set the button color for the first time. I tried something similar but without success.

The problem is, that Gnome2::Canvas::Shape is NOT a Gtk2::Widget, so it does
not have realize nor map signals. The SET_PROPERTY approach should be better
and has the added benefit that the shape is reset when the properties are
changed later.
Thanks, Jan, for the suggestion. I've modified the SET_PROPERTY as you suggested and still no rounded rectangle.

I've written a similar program using composition rather than inheritance and I get a rounded rectangle. I'd use this rectangle except that I am unable to set the 'fill-color', and I get events only when the mouse is placed directly on the outline. No signals when the mouse is moved inside the rounded rectangle. Is this the correct behavior of the Gnome2::Canvas::Shape ? If so, I shall have to come up with a "plan b".


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