Re: GnomeCanvasGroup disappearing tricks
- From: "John R. Sheets" <dusk ravendusk org>
- To: gnome-devel-list gnome org
- Subject: Re: GnomeCanvasGroup disappearing tricks
- Date: Wed, 21 Feb 2001 12:28:52 -0600
On Feb 20, 2001, James Eagan <eaganj bazza com> wrote:
>
> Instead, what I'm seeing is the rectangle draws correctly when the mouse
> button is pressed, but as the rectangle moves around, it gets clipped by
> its original bounds,
Right, I was getting something like this, too, in my Anvil gaming
client. IIRC (it was over a month ago), it happened when I tried to
set the position directly, to an absolute value, with the "x" and "y"
properties:
gnome_canvas_item_set (GNOME_CANVAS_ITEM(canvas_item),
"x", 10.0, "y", 50.0, NULL);
When I switched back to using gnome_canvas_item_move(), the problem
went away (errr, unless my memory is fuzzy and the problem was caused
by something different). (c:
I must admit to being perplexed by the absence of a
gnome_canvas_item_move_to() function, because it's often useful (and
in my case necessary) to move items to absolute locations on the
canvas. Hopefully that can be fixed in GNOME 2.0. In the meantime,
if you need absolute positioning, you can do something like this:
GtkArg args[2];
gdouble xcurrent, ycurrent;
args[0].name = "x";
args[1].name = "y";
gtk_object_getv (GTK_OBJECT(canvas_item), 2, args);
xcurrent = GTK_VALUE_DOUBLE(args[0]);
ycurrent = GTK_VALUE_DOUBLE(args[1]);
/* Move to (0, 0) */
gnome_canvas_item_move (GNOME_CANVAS_ITEM(canvas_item),
-xcurrent, -ycurrent);
/* From there, move to absolute coords (xnew, ynew) */
gnome_canvas_item_move (GNOME_CANVAS_ITEM(canvas_item),
xnew, ynew);
There's probably a better way to do it, though.
John
--
dusk ravendusk org http://www.gnome.org
jsheets codeweavers com http://www.worldforge.org
jsheets users sourceforge net http://openbooks.sourceforge.net
http://advogato.org/person/jsheets
Writing Gnome Applications
http://www.aw.com/cseng/titles/0-201-65791-0/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]