[Glade-users] Canvas questions



I have the following code in callbacks.c assigned to a button

void
on_button4_clicked                     (GtkButton       *button,
                                        gpointer         user_data)
{
GtkWidget *canvas1;
GnomeCanvasPoints *points1;
static gdouble xval = 0;
static gdouble yval = 0;
GtkWidget *item;
canvas1 = lookup_widget (GTK_WIDGET (button), "canvas1"); 

points1 = gnome_canvas_points_new(2);
points1->coords[0] = 1;
points1->coords[1] = 1;
points1->coords[2] = 100;
points1->coords[3] = 100;
xval = 10;
yval = 10;
item = gnome_canvas_item_new(gnome_canvas_root(canvas1),
                             GNOME_TYPE_CANVAS_LINE,
                             "points", points1,
                             "fill_color", "red",
                             NULL);


gnome_canvas_item_new(gnome_canvas_root(canvas1),
                             GNOME_TYPE_CANVAS_TEXT,
                             "text", "dog",
                     "x", xval, "y", yval,      
                             "fill_color", "red",
                          NULL);
}

My questions are:
 1. Is there an example anywhere for using the canvas, the example supplied
(editor) is very good but does not use the canvas.

 2 . My code will draw the line fine but when I compile this I get -
    warning: passing arg1 of `gnome_canvas_root' from incompatible pointer
type- 
How do I need to declare canvas1, what am I doing wrong?

3. I cannot get the text to show up at all. I cannot find an example
anywhere that uses text.

Please forgive my ignorance, I am still new at this but if I had some other
code to reference it would be much appreciated. I am using Glade 0.5.11 with 
RH 6.2
Thank you much -George 
 





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