[Glade-users] HELP: Having an issue with GnomeCanvas



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi folks,

First let me introduce myself since I'm new to the list.  I am getting
back into C/C++ programming after not doing any for a very long time.
One of my personal projects that I'm working on is a map generator for
Fantasy Role Playing games.

To that end I've started crafting some code and I've used Glade 3 to
generate my GUI. So far so good.

Where things go horribly wrong is when I actually try to draw a map.

One of my GUI elements consists of a Gnome Canvas and a row of buttons
along with the appropriate containers to make everything stay where I
want it.

Here is the C++ code (or just enough to make my point) to actually put a
drawing on the canvas:

void sectorGrid(){
        GtkWidget   *sectorCanvas;
        GnomeCanvasGroup *group;
        GnomeCanvasPoints *points;
        GnomeCanvasItem   *item;
        double           max_x=640.0;
        double           max_y=960.0;
        
        
        sectorCanvas =  glade_xml_get_widget(gxml,"sectorCanvas");
        
        
        
        group = gnome_canvas_root(GNOME_CANVAS( sectorCanvas));
        
        points = gnome_canvas_points_new(5);
        /**
         * Nice box around the whole perimeter of the map
         *
         */
        points->coords[0]=0;
        points->coords[1]=0;
        points->coords[2]=max_x;
        points->coords[3]=0;
        points->coords[4]=max_x;
        points->coords[5]=max_y;
        points->coords[6]=0;
        points->coords[7]=max_y;
        points->coords[8]=0;
        points->coords[9]=0;
        
        item = gnome_canvas_item_new(group,
                        gnome_canvas_polygon_get_type(),
                         "points",points,
                         "fill_color","blue",
                         "outline_color","black",
                         "width_units",4.0,
                         NULL);
        
}

When I run the program I get:

(frpstarmap:4002): GnomeCanvas-CRITICAL **: gnome_canvas_root: assertion
`GNOME_IS_CANVAS (canvas)' failed

(frpstarmap:4002): GnomeCanvas-CRITICAL **: gnome_canvas_item_new:
assertion `GNOME_IS_CANVAS_GROUP (parent)' failed

Where am I going wrong?  What's the secret?

- ----

Peter L. Berghold                   Unix Professional
Peter at Berghold.Net             AIM: redcowdawg YIM: blue_cowdawg
"Those who fail to learn from history are condemned to repeat it."

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFH1vcQUM9/01RIhaARAouqAJ92Q0eXGwJbiV8HRvQYhfY4Jy8GWgCdGQtx
ucLQzN6D/TwQGBUVcx3RQgs=
=sAao
-----END PGP SIGNATURE-----




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