GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Wed Oct 01, 2014 12:16 pm

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Problems with drawing in a DrawingArea
PostPosted: Sun Mar 16, 2008 4:58 pm 
Offline

Joined: Sun Mar 16, 2008 4:25 pm
Posts: 4
Hi,
i have a very hard problem with a drawing area and i couldn't find a solution for that problem.
I created 2 (dialog) windows.
The first one contains a drawing area. Inside of the drawing area i want to draw some circles. This circles are showing the state of some lamps (light on=red filled circle, or light off=black filled circle).
The state of the lamps should be updated every 100ms.
The second window contains some dialog items like buttons, sliders and so on for configuration.
I'm calling the function:
gtk_widget_queue_draw_area( drawingArea,
0,0,
drawingArea->allocation.width,
drawingArea->allocation.height);
every 100ms.

inside of the expose event function i'm drawing the images with:

if( light == ON )
gdk_draw_pixbuf(widget->window,
drawGc,
imageRed,
0,0,
xpos,ypos,
-1,-1,
GDK_RGB_DITHER_NONE,
0,0);
else
gdk_draw_pixbuf(widget->window,
drawGc,
imageBlack,
0,0,
xpos,ypos,
-1,-1,
GDK_RGB_DITHER_NONE,
0,0);

this works fine, but after some minutes the drawed circles and the dialog items (buttons a.s.o.) disapears. So i have 2 Windows containing nothing.
Is there anybody who can help me?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 18, 2008 9:40 pm 
Offline

Joined: Sun Mar 16, 2008 4:25 pm
Posts: 4
Seems, that it is not possible to draw items in a frequently way..
Is there nobody, who knows, how to draw in a drawing area?
nothing of the examples i found works.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 19, 2008 8:11 am 
Offline
Familiar Face

Joined: Wed Mar 05, 2008 8:01 am
Posts: 5
It is very easy. Just place all your draw functions in the "expose" event for the GtkDrawing area and everything will be fine.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: Google Adsense [Bot] and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group