Re: g_timeout_add events stop when calling draw_brush()
- From: Douglas Phillipson <dougp intermind net>
- To: Douglas Phillipson <dougp intermind net>
- Cc: John K Luebs <jkluebs luebsphoto com>, gtk-app-devel-list gnome org
- Subject: Re: g_timeout_add events stop when calling draw_brush()
- Date: Sun, 29 Feb 2004 18:11:33 -0800
Douglas Phillipson wrote:
John K Luebs wrote:
On Sun, Feb 29, 2004 at 03:06:00PM -0800, Douglas Phillipson wrote:
Douglas Phillipson wrote:
I'm using g_timeout_add (500, grab_data, NULL) to aquire data from
a file and shift it through an array with some procesing on it.
This all works fine. At the end of the routine I call draw_brush to
paint the data to the screen but the "timeout" event stops after the
first call to draw_brush. I can comment out the draw_brush() call
and events happen as they should. What might be causing this?
A more general question related to the above problem.
I'm not drawing. I'm displaying chart like graphic data points.
Without touching any buttons or the screen, how can I force an update
to my draw_area once a second? I'm using g_timeout_add to force a
read of a file, all working well. But I'm trying to throw a expose
event on the draw area from the function called by the "timeout"
callback. It doesn't seem to force a screen update via draw_brush.
Any suggestions?
I'm not quite sure I understand what you're trying to do, but you
shouldn't draw from anywhere outside of handling an expose event. If
you want to "force" an expose event then use gtk_widget_queue_draw.
--jkl
I'm taking in information from a file and displaying it on a draw_area.
I use g_timeout_add to force the call of my data collection routine.
This occurs on a regular interval. I take the data and shift it through
an array to normalize it to x,y coords that will be within screen
boundaries. After each second, I need the screen to update. In the
draw_brush code I do the drawing of points from the array. Again no
events are occuring other than the input of data from a file. I presume
I need to clear the pixmap prior to each draw. I do this in the
g_timeout_add callback routine with:
gdk_draw_rectangle (pixmap, widget->style->black_gc, TRUE,
0, 0, widget->allocation.width, widget->allocation.height);
then proceed to draw the points on the pixmap. The trouble is I am not
getting any refresh events to the draw_area in order to copy the pixmap
to the screen, because I'm not doing anything that triggers a refresh
event, like drawing with the stylist. I also have to figure out how to
get the widget handle for the draw_area to call the gdk_draw_rectangle()
routine. I'm in a callback that doesn't have a reference to the handle
for the draw_area. If the draw_area handle is global, cat I just use it
for the "widget->style->black_gc"?
Also, what advantages would a "image" have over a draw_area, if any?
Thanks
DOug P
Well gtk_widget_queue_draw_area or gtk_widget_queue_draw doesn't force
or appear to queue any drawing. I call it from the callback created
with g_timeout_add but nothing happens. If I click in the draw_area and
drag, I see my drawing is going to the pixmap. The drag events in the
draw area show me my plotting of dots but when I stop dragging, the
events stop. Start dragging, the plotting continues.
Confused
Doug P
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]