drawing in a for-loop

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

 




OK, this is probably the stupidest post ever, but I need help drawing in a for-loop within a callback function... I've done this before, but for some reason, I'm not getting expose events to refresh my GtkDrawingArea... My code looks like this (using gtkmm, but doesn't matter)...



void mainWindow::button_callback() { //GtkDrawingArea is called '* area' width = GTK_WIDGET(area)->allocation.width; height = " " ".height;

  for (int i=0; i<200; i++)
  {
    gdk_draw_point(this->pixmap,GTK_WIDGET(area)->style->black_gc,i,i);
    gtk_widget_queue_draw_area((GtkWidget *) area,0,0,width,height);
    delay-for-a-split-second();
  }
}


bool mainWindow::drawingarea_expose(GdkEventExpose* exp) { gdk_draw_drawable(GTK_WIDGET(area)->window, GTK_WIDGET(area)->style->fg_gc[GTK_WIDGET_STATE(GTK_WIDGET(area))], this->pixmap, exp->area.x, exp->area.y, exp->area.x, exp->area.y, exp->area.width, exp->area.height);

  return 0;
}



Obviously, this should draw a line one pixel at a time... Everything is *drawn* correctly, but it doesn't display each pixel as it's drawn -- instead it just shows the whole line drawn to completion after the loop is done... I need to see each pixel popping up individually... This is why I think it's an expose issue...

Don't worry, everything is defined, signals connected to the callbacks, etc... I just want to know why this logic doesn't refresh the display after each iteration... Please help... Thanks...

	- Ian

-------------------------------------------------------------------------------
C makes it easy to shoot yourself in the foot; C++ makes it
harder, but when you do, it blows away your whole leg...
		-- Bjarne Stroustrup
-------------------------------------------------------------------------------
_______________________________________________

gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux