[gnomemm] CanvasItem Event Handling error.(Code)



class Tree{
...
private:
  void second_walk();
....
};

void Tree:: second_walk(){
...

          if(isNode)
{ node = new CanvasEllipse(*(canvas->root()),x_coord-NODE_SIZE/2, y_coord-NODE_SIZE/2, x_coord+NODE_SIZE/2, y_coord+NODE_SIZE/2);
          }
          else
          {
               using namespace Gnome::Art;
               Gnome::CanvasPoints points;
               points.push_back(Point(x_coord,y_coord-NODE_SIZE/2));
points.push_back(Point(x_coord-SIB_SEPARATION-NODE_SIZE/2,y_coord+LEVEL_SEPARATION));

points.push_back(Point(x_coord+SIB_SEPARATION+NODE_SIZE/2,y_coord+LEVEL_SEPARATION));

               node = new CanvasPolygon(*(canvas->root()),points);
          }
          if(!isNode)
          {
               //CanvasPolygon tmp = (CanvasPolygon)(*node);
               ((CanvasPolygon&)*node).set_fill_color("red");
          }
          else
          {
               //CanvasEllipse tmp = (CanvasEllipse)(*node);
               if(!isLeaf)
                       ((CanvasEllipse &)*node).set_fill_color("blue");
               else if(isFail)
                       ((CanvasEllipse &)*node).set_fill_color("red");
               else
                       ((CanvasEllipse &)*node).set_fill_color("green");
          }
node->event.connect(slot(this, &Tree::compute));

...

}


If i remove the line node->event.connect(....) the peogram run well. So i think the statment have error. Right? Why.

_________________________________________________________________
与联机的朋友进行交流,请使用 MSN Messenger: http://messenger.microsoft.com/cn




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