我想为goocanvasmm文本项设置文本锚点。但我无法让例子运行
Goocanvas::Text::create("Any Text", 0, 0, -1, Goocanvas::ANCHOR_NORTH);
错误:'ANCHOR_NORTH'不是'Goocanvas'的成员
Goocanvas::Text::create("Any Text", 0, 0, -1, Goocanvas::ANCHOR_N);
错误:'ANCHOR_N'不是'Goocanvas'的成员
我不知道这个项目所在的命名空间或子类。有人可以帮忙吗?
答案 0 :(得分:0)
枚举器的定义如下:
enum Goocanvas::AnchorType {
Goocanvas::ANCHOR_CENTER,
Goocanvas::ANCHOR_NORTH,
Goocanvas::ANCHOR_NORTH_WEST,
Goocanvas::ANCHOR_NORTH_EAST,
Goocanvas::ANCHOR_SOUTH,
Goocanvas::ANCHOR_SOUTH_WEST,
Goocanvas::ANCHOR_SOUTH_EAST,
Goocanvas::ANCHOR_WEST,
Goocanvas::ANCHOR_EAST,
Goocanvas::ANCHOR_N = ANCHOR_NORTH,
Goocanvas::ANCHOR_NW = ANCHOR_NORTH_WEST,
Goocanvas::ANCHOR_NE = ANCHOR_NORTH_EAST,
Goocanvas::ANCHOR_S = ANCHOR_SOUTH,
Goocanvas::ANCHOR_SW = ANCHOR_SOUTH_WEST,
Goocanvas::ANCHOR_SE = ANCHOR_SOUTH_EAST,
Goocanvas::ANCHOR_W = ANCHOR_WEST,
Goocanvas::ANCHOR_E = ANCHOR_EAST
}
所以你的代码应该工作,除非你做了一些命名空间foo(即use blurb
)。尝试直接使用C定义(即ANCHOR_SOUTH_WEST
- 无命名空间)。