Re: [gtkmm] Gtk::DrawingArea



On Wed, Aug 20, 2003 at 10:44:21PM +0200, Joerg Anders wrote:
> I'm a gtkmm beginner. I tried the "cust_draw_area" example
> class from:

Hi, Welcome to the wonderful world of gtkmm:)

> http://www.gtkmm.org/gtkmm2/docs/tutorial/html/ch14s06.html
> 
> The result is:
> 
> $ g++ `pkg-config --cflags gtkmm-2.0` -c cust_draw_area.cpp
> 
> /usr/include/gtkmm-2.0/gtkmm/widget.h:353:   overriding `virtual bool 
>    Gtk::Widget::on_expose_event(GdkEventExpose*)'
> cust_draw_area.cpp: In constructor `cust_draw_area::cust_draw_area(int, int)':
> cust_draw_area.cpp:19: `size' undeclared (first use this function)
> cust_draw_area.cpp:19: (Each undeclared identifier is reported only once for 
>    each function it appears in.)
> cust_draw_area.cpp: In member function `virtual int 
>    cust_draw_area::on_expose_event(GdkEventExpose*)':
> cust_draw_area.cpp:25: no matching function for call to `
>    Glib::RefPtr<Gdk::Window>::draw_line(Glib::RefPtr<Gdk::GC>, int, int, int, 
>    int)'

Looks to me like you found a mistake in the docs there. I believe the
call to 'size' in the constructor should read:
	set_size_request(width, height);
rather than just
	size(width, height);
	
(Or maybe it should be set_default_size(width, height); - the difference
 being the first sets a minimum size for the window, which it then
 cannot be resized smaller than, and this one sets the initial size,
 allowing the window to be resized.)

As for the errors from line 25 onwards, I think they should be
get_window()->draw... rather than get_window().draw...
(But I'm not a gtkmm expert, and I don't have a system I can try stuff
 out on to hand, I'm afraid.)

I hope this helps,
	Ainsley.



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