On Thu, Aug 11, 2005 at 10:41:08 -0400, James Muir wrote:
Jan Hudec wrote:On Wed, Aug 10, 2005 at 13:56:18 -0400, James Muir wrote: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.
Hm, strange. But I have only ever used this with Gtk2::Widget objects, so there may be another gotcha in Gnome2::Canvas::Item, which is not a widget.
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".
Gnome2::Canvas::Rect->isa('Gnome2::Canvas::Shape'), so shape must provide enough base functionality for it. So though I don't know for sure, I'd think it's not correct. I suggest you take sources of the gnome canvas library itself (not the bindings, the actual C library) and have a look at GnomeCanvasRect, how it sets the shape. By the way, you should be able to inherit GnomeCanvasRE, which comes with the x1, y1, x2, y2 properties built in (and probably nothing else). ------------------------------------------------------------------------------- Jan 'Bulb' Hudec <bulb ucw cz>
Attachment:
signature.asc
Description: Digital signature