drawn on drawable disapper ?

hi,i have drawn one line in callback on focus to
drawable,drawn line won't appear permanently.if i use
sleep for 2 sec, it will appear for 2 sec. if i draw
same thing for expose event it displays permanently.
can anybody look at my code & tell me wht changes i
have to do. finally i want to draw some points on 
drawable for focus event.

GtkWidget *da; 
GtkWidget *entry;
gint draw_pixel( GtkWidget *da,GdkEvent *event,
gpointer  data) {
int x,y= 10;
for (x = 2; x < 135;x++)
gdk_draw_point (da->window, da->style->black_gc, x,
gtk_widget_show_now (da);
sleep (2);

gint textbox1 (GtkWidget *entry,GdkEvent
*event,gpointer data) {
printf (" text  => %s\n",gtk_entry_get_text (GTK_ENTRY
gtk_widget_grab_focus (da);

main (int argc, char *argv []) {
GtkWidget *window;
GtkWidget *fixed;
GtkStyle *style;
GdkColor color;

gtk_init (&argc, &argv);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);fixed =
gtk_fixed_new ();
style = gtk_style_copy  (gtk_widget_get_default_style
gtk_widget_set_size_request (window,500,400);

color.red = 64520;color.blue = 23032;
color.green = 43773;
style->bg[GTK_STATE_NORMAL] = color;
gtk_widget_set_style (window, style);

da = gtk_drawing_area_new ();
gtk_drawing_area_size (GTK_DRAWING_AREA (da), 140,

entry = gtk_entry_new ();
gtk_widget_show (entry);
gtk_fixed_put (GTK_FIXED (fixed),entry,120,30);
gtk_fixed_put (GTK_FIXED (fixed),da,120,60);

gtk_signal_connect (GTK_OBJECT
(entry),"activate",GTK_SIGNAL_FUNC (textbox1),NULL);
gtk_signal_connect (GTK_OBJECT
// gtk_signal_connect (GTK_OBJECT
gtk_container_add (GTK_CONTAINER(window),fixed);
gtk_widget_show_all (window);
gtk_main ();

Yahoo! India Matrimony: Find your partner online.
Go to http://yahoo.shaadi.com

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