Re: drawing a line



Shiraz Baig wrote:

 > Hi,
 > I want to draw a line when I push a button. I have
 > written the following code. It draws line thru two
 > alternative signal commands.
 > a. Thru the timer function.
 > b. Thru the push button.
 >
 > It works with the timer function. But it does not work
 > with the push button.
 >
 > Question:
 > Can anyone suggest how can it draw the line when I
 > click the button?
 >


Hi, you need to connect to "expose_event" and do your repaint there.

Don't paint on button click. Instead, change your model (your internal 
representation of what it is you are showing on the screen), and ask for 
a repaint to be queued for your window with gtk_widget_draw().

Also, you have a problem with your button callback.

The scribble example covers some of this stuff:

http://www.gtk.org/tutorial/sec-thedrawingareawidget.html

John




========================================================== 
Coming soon: 
Aelbert Cuyp 13 February - 12 May 2002 

For information and tickets: 
http://www.nationalgallery.org.uk



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