Re: canvas
- From: Martin Oberzalek <oberzalek chello at>
- To: gnome-devel-list gnome org
- Subject: Re: canvas
- Date: Wed, 2 Feb 2000 15:44:34 +0100
On Wed, Feb 02, 2000 at 02:33:54PM +0100, Jens Finke wrote:
> On Wed, 2 Feb 2000, Martin Oberzalek wrote:
> > After moving a GnomeCanvasItem the item will never be shown.
> > I tried gnome_canvas_update_now( canvas );
> > gnome_canvas_item_raise_to_top( item );
> > gtk_widget_draw( canvas );
>
> Can you give more details? For me gnome_canvas_item_move() works perfect.
> Normally you don't have to call any update function.
have a look at this example:
------------------------------
#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;
}
int main( int argc, char *argv[] )
{
GtkWidget *window;
gnome_init( "test", "0.1", argc, argv );
window = gnome_app_new("beepball", _("BeepBall"));
gtk_window_set_policy( GTK_WINDOW( window ), FALSE, FALSE, TRUE );
gtk_widget_show( window );
canvas = gnome_canvas_new();
gnome_app_set_contents(GNOME_APP( window ), canvas );
gtk_widget_show( canvas );
gtk_widget_set_usize(window, 200, 200);
gnome_canvas_set_scroll_region( GNOME_CANVAS(canvas),
0.0, 0.0,
200,
200);
bg = gnome_canvas_item_new( gnome_canvas_root( GNOME_CANVAS(canvas)),
gnome_canvas_rect_get_type(),
"x1", (double) 0,
"y1", (double) 0,
"x2", (double) 200,
"y2", (double) 200,
"fill_color", "black",
"outline_color", "black"
"width_units", 1.0,
NULL);
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);
gtk_timeout_add( 800, timefunc, NULL );
gtk_main();
return 0;
}
-----------------------------
I'm sure that I missed doing something important.
But what?
--
Gruß King Leo
------------------------
| (__) (__) (__) |
| ( oo (oo) oo ) |
| /\_| /\/\ |_/\ |
------------------------
| The Cow is with me |
------------------------
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]