GtkDrawingArea



        Hi,

        I'm looking for a way of drawing with the mouse in a
        GtkDrawingArea.

        By now I used an ugly code that was :

    drawing_area = gtk_drawing_area_new ();
    gtk_drawing_area_size (GTK_DRAWING_AREA (drawing_area), GRAPH_W,
                           GRAPH_H);
    GTK_WIDGET_SET_FLAGS (GTK_WIDGET (drawing_area), GTK_CAN_FOCUS);
    gtk_widget_set_sensitive (GTK_WIDGET (drawing_area), TRUE);
    gtk_signal_connect (GTK_OBJECT (drawing_area), "button-press-event",
                        GTK_SIGNAL_FUNC (set_pos),
                        NULL);
    gtk_signal_connect (GTK_OBJECT (drawing_area), "expose-event",
                        GTK_SIGNAL_FUNC (draw_map),
                        NULL);
    gtk_container_add (GTK_CONTAINER (berceau), drawing_area);
    gtk_widget_show (drawing_area);
    gtk_widget_set_events (widget, -1);

        It was Ok. But it was done at the app-init level and now I
        need to do it at any time when I change the view... And it
        tells me :
Gtk-CRITICAL **: file gtkwidget.c: line 3820 (gtk_widget_set_events):
assertion `!GTK_WIDGET_REALIZED (widget)' failed.

        So I added a function attached to an event :

    gtk_signal_connect (GTK_OBJECT (drawing_area), "realize",
                        GTK_SIGNAL_FUNC (set_events_da),
                        NULL);

        which only contains
    gtk_widget_set_events (widget, -1);

        in order to have it done only when the widget is realized.
        But it does not work...

        Does any one have an idea ? I'm totaly lost...


-- 
 Sur frg ça se passe bien car les gens qui n'ont pas le permis sont
 assez tolérents entre eux sur les fautes de conduite, sur fufe ça
 tourne au massacre car les dino ne laissent pas les neuneus faire.
 -+- GR In Guide du Généalogiste Ereinté : Le choc des générations -+-





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