drawn on drawable disapper ?
- From: manu aradhya <manu_aradhya yahoo co in>
- To: gtk-app-devel-list gnome org
- Subject: drawn on drawable disapper ?
- Date: Mon, 29 Sep 2003 13:04:43 +0100 (BST)
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,
y);
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
(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,
30);
GTK_WIDGET_SET_FLAGS (da, GTK_CAN_FOCUS);
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
(da),"expose_event",GTK_SIGNAL_FUNC
(draw_pixel),NULL);
// gtk_signal_connect (GTK_OBJECT
(da),"focus_in_event",GTK_SIGNAL_FUNC
(draw_pixel),NULL);
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]