Thread: [Goocanvas-devel] goocanvasmm set_bounds
Status: Beta
Brought to you by:
dachaplin
From: Robert G. <do...@gm...> - 2008-05-21 01:08:27
|
Hi all, first of all thanks for these widgets, really very useful library. I'm not sure if this list also covers goocanvasmm related stuff, but i couldn't find any specific one for it. I'm trying to change the start/end positions of a Goocanvas::Polyline. As far as i've understood set_bounds() and get_bounds() can be used for this purpose. Here's how i tried to do it: Goocanvas::Bounds bounds = connection->get_bounds(); bounds.set_x2(this->get_bounds().get_x1()); bounds.set_y2(this->get_bounds().get_y1()); connection->set_bounds(bounds); connection->request_update(); connection is a Class derived from Goocanvas::Polyline. the containing class derives from Goocanvas::Rect This code doesn't change the shape of the line. Calling connection->set_simple_transform() however does change the position of the whole line, but what i'd need to do is to only change the x1/y1 or x2/y2 coordinate of it. thanks for your help! -robert |
From: Damon C. <da...@ka...> - 2008-05-21 08:17:43
|
On Wed, 2008-05-21 at 03:08 +0200, Robert Gruendler wrote: > Hi all, > > first of all thanks for these widgets, really very useful library. > > I'm not sure if this list also covers goocanvasmm related stuff, > but i couldn't find any specific one for it. > > I'm trying to change the start/end positions of a Goocanvas::Polyline. > As > far as i've understood set_bounds() and get_bounds() can be used > for this purpose. > > Here's how i tried to do it: > > Goocanvas::Bounds bounds = connection->get_bounds(); > bounds.set_x2(this->get_bounds().get_x1()); > bounds.set_y2(this->get_bounds().get_y1()); > connection->set_bounds(bounds); > connection->request_update(); > > connection is a Class derived from Goocanvas::Polyline. > the containing class derives from Goocanvas::Rect > > This code doesn't change the shape of the line. > Calling connection->set_simple_transform() however does change > the position of the whole line, but what i'd need to do is to only > change the x1/y1 or x2/y2 coordinate of it. In C I think you could get the polyline's "points" property, change the array of point coordinates, and then set it back. I guess that would also work in C++. Damon |
From: Robert G. <do...@gm...> - 2008-05-24 01:02:09
|
thanks, altering the points array did the trick -robert On Wed, May 21, 2008 at 10:11 AM, Damon Chaplin <da...@ka...> wrote: > > On Wed, 2008-05-21 at 03:08 +0200, Robert Gruendler wrote: > > Hi all, > > > > first of all thanks for these widgets, really very useful library. > > > > I'm not sure if this list also covers goocanvasmm related stuff, > > but i couldn't find any specific one for it. > > > > I'm trying to change the start/end positions of a Goocanvas::Polyline. > > As > > far as i've understood set_bounds() and get_bounds() can be used > > for this purpose. > > > > Here's how i tried to do it: > > > > Goocanvas::Bounds bounds = connection->get_bounds(); > > bounds.set_x2(this->get_bounds().get_x1()); > > bounds.set_y2(this->get_bounds().get_y1()); > > connection->set_bounds(bounds); > > connection->request_update(); > > > > connection is a Class derived from Goocanvas::Polyline. > > the containing class derives from Goocanvas::Rect > > > > This code doesn't change the shape of the line. > > Calling connection->set_simple_transform() however does change > > the position of the whole line, but what i'd need to do is to only > > change the x1/y1 or x2/y2 coordinate of it. > > In C I think you could get the polyline's "points" property, change the > array of point coordinates, and then set it back. I guess that would > also work in C++. > > Damon > > |