- 积分
- 900
- 明经币
- 个
- 注册时间
- 2005-11-23
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
楼主 |
发表于 2011-1-9 11:04:20
|
显示全部楼层
AutoCAD 2011 for MAC ARX 开发学习笔记(三)
虽然我们已经创建了Hello World,感觉容易是因为Autodesk为我们做了大部分的工作,有关MAC OS的细节可以不用关心。
但一个真正实用的ARX程序只靠命令行是无法取悦客户的,所以如果想要友好的交互界面,必须要涉足MAC OS的界面交互编程。
如果有一定ARX程序编写经验,知道在Windows中有两种选择,Windows API和MFC,估计大多数人不会选择Windows API,MFC封装了Windows API的大部分功能,通过对象、方法创制界面,比用一个个复杂参数起名怪异的API函数好用多了。但是否可以不用Windows API呢,不行,有些特别的应用离不开API。
跟Windows环境一样,MAC OS提供同样的两套编程方式以供选择,Cocoa和Carbon。
Cocoa类似于MFC
Carbon类似于Windows API
根据我在Cocoa上不多的经验,感觉Cocoa比MFC好用多了,引用Cocoa教程中一段,差距就如书中所讲:
Once upon a time, there was a company called Taligent, which was created by IBM and Apple to develop a set of tools and libraries like Cocoa. About the time Taligent reached the peak of its mindshare, I met one of its engineers at a trade show. I asked him to create a simple application for me: A window would appear with a button, and when the button was clicked, the words "Hello, World!" would appear in a text field. The engineer created a project and started subclassing madly: subclassing the window and the button and the event handler. Then he started generating code: dozens of lines to get the button and the text field onto the window. After 45 minutes, I had to leave. The app still did not work. That day, I knew that the company was doomed. A couple of years later, Taligent quietly closed its doors forever. |
|