Re: Drawing in a Widget



Fabiano Fantini Vitale <ffv@conectiva.com.br> writes:
> 
> i like to known why doesn`t appear a rectangle inside
> the widget window  in the follow small code . 
> 
> #include <gtk/gtk.h>
> 
> int main(int argc, char **argv)
> {
>         GtkWidget *window;
> 
>         gtk_init(&argc, &argv);
> 
>         window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
>         gtk_widget_set_usize(window, 100, 100);
>         gtk_widget_realize(window);
> 
>         gdk_draw_rectangle(window->window, window->style->fg_gc[GTK_WIDGET_STATE(window)], 1, 1, 1, 20, 20);
> 

Read the "scribble" example in the tutorial. GDK drawables don't remember
their contents; you have to refresh them when you get expose events.

Havoc




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