标题: CAA插件求助 [打印本页] 作者: netroamer 时间: 2006-11-15 22:49 标题: CAA插件求助 我在catia中做了一个插件,添加了工具栏和菜单,是不是工具栏里的每个命令都必须有一个类来实现?我要添加很多命令,这样岂不是需要很多类吗?能不能只用一个类,而将工具栏里的命令和类的成员函数关联起来?
我的代码如下:
// Creates the CAAMyHeader command header class
MacDeclareHeader(CAAMyHeader);
在CAAMyAddin::CreateCommands()中加入:
new CAAMyHeader("MyCommand","CAAMyCommand", "CAAMyCommandCmd",(void *)NULL);作者: netroamer 时间: 2006-11-16 15:04
没有人知道吗?大家帮帮忙啊,谢谢了!作者: xyzhu 时间: 2006-11-17 16:51
You can use one command class to control all toolbar buttons:
new CAAMyHeader("CommandName1","CommandLibName", "MyCommandClass",(void *)pParameter1);
new CAAMyHeader("CommandName2","CommandLibName", "MyCommandClass",(void *)pParameter2);
...
The last parameter is used to determine in the command class, which toolbar button is pushed. The "MyCommandClass" constructor must have a parameter with type void*. And in the .cpp file insert CATCreateClassArg(MyCommandClass, void); instead of CATCreateClass.作者: netroamer 时间: 2006-11-18 20:51
谢谢xyzhu,按你的方法改好了,非常感谢!