Re: canvas



Martin Oberzalek wrote:
> 
> #include <gnome.h>
> 
> GtkWidget *canvas;
> GnomeCanvasItem *item, *bg;
> 
> int x=0;
> 
> int timefunc( gpointer data)
> {
>   x = x + 10;
> 
>   gnome_canvas_item_move( item, x, 100 );
> 
>   return TRUE;
> }
> 
> [...]
>    gtk_widget_set_usize(window, 200, 200);
>    gnome_canvas_set_scroll_region( GNOME_CANVAS(canvas),
>                                    0.0, 0.0,
>                                    200,
>                                    200);
> [...]
>    item = gnome_canvas_item_new( gnome_canvas_root( GNOME_CANVAS(canvas)),
>                                  gnome_canvas_rect_get_type(),
>                                  "x1", (double) 0,
>                                  "y1", (double) 100,
>                                  "x2", (double) 40,
>                                  "y2", (double) 110,
>                                  "fill_color", "red",
>                                  "outline_color", "green"
>                                  "width_units", 1.0,
>                                  NULL);

I think the problem is that you move the item out of the visible area.
Consider that gnome_canvas_item_move adds the x and y parameter to the
current position of the item. I think you want to move the item
horizontal 10 units per function call. Then use this:
gnome_canvas_item_move(item, 10, 0);

Hope this helps.
    
  Jens



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