Re: [gnomemm] How to use Gnome::Canvas::Canvas



On Fri, 2004-06-25 at 22:29 +0200, Samuel Abels wrote:
> Hello,
> 
> I have studied the API references and I am trying to create a simple
> Gnome::Canvas::Canvas. Unfortunately I have not found much
> documentation, so here is how far I have come:

There are examples in the source tarball. Have you looked at them?

> 
> MyWindow::MyWindow()
> {
>   using namespace Gnome;
>   Canvas::init();
>   Canvas::Canvas* canvas = new Canvas::Canvas;
>   Label*          label  = new Label;
>   // Draw a label widget:
>   new Canvas::Widget(*canvas->root(), 0, 0, *label);
>   // Draw a rectangle:
>   //new Canvas::Rect(*canvas->root(), 1, 1, 50, 50);
>   label->show();
>   canvas->set_size_request(400, 400);
>   canvas->set_scroll_region(0, 0, 400, 400);
>   canvas->update_now();
>   add(*manage(*canvas));
>   show_all();
> }
> 
> Drawing the rectangle, the program will exit:
> 
> GnomeCanvas-ERROR **: file gnome-canvas-shape.c: line 842
> (gnome_canvas_shape_update_gdk): assertion failed: (gdk != NULL)
> aborting...
> 
> Drawing only the label, the program will start, but the canvas is
> displayed as an empty rectangle and the label widget does not show up.
> 
> Now I am sure that I am just not using this properly, but I have not
> found any documentation explaining this.
> 
> Can somebody please help out?
> 
> Thanks!
> -Samuel
-- 
Murray Cumming
murrayc murrayc com
www.murrayc.com





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