创建CAA对话框程序的详细步骤

2014-07-28 21:38:57|?次阅读|上传:wustguangh【已有?条评论】发表评论

关键词:C/C++, CAA, CATIA|来源:唯设编程网

在该头文件中:

  • CAADlgHelloWindow类什么了其父类是CATDlgDocument;
  • DeclareResource宏允许从外部资源文件获取类的资源,比如显示在窗口中的字符串;
  • 定义了该类的构造函数;
  • 用于创建窗口组件并且为其复制的Build方法;
  • 单用户关闭窗口时用于关闭应用程序的Exit方法;
  • 一个指向应用程序(Application)实例的指针(reference);
  1. 完成“CAADlgHelloWindow.cpp”的代码如下:
// COPYRIGHT DASSAULT SYSTEMES 2003

// Local Framework

#include "CAADlgHelloWindow.h"

// Dialog Framework

#include "CATInteractiveApplication.h"    // For the current application to destroy

#include "CATDlgInclude.h"                // For the label

// C++ Standard library

#include "iostream.h"

//--------------------------------------------------------------------------------------

CAADlgHelloWindow::CAADlgHelloWindow(CATInteractiveApplication * iParentCommand)                             

: CATDlgDocument(iParentCommand, "CAADlgHelloWindowId"),_pHelloApplication(iParentCommand)

{

  cout << "CAADlgHelloWindow::CAADlgHelloWindow" << endl;

  // Don't construct any Dialog's Object child in the constructor

  // Use the Build Method to do this.

}

//--------------------------------------------------------------------------------------

CAADlgHelloWindow::~CAADlgHelloWindow()

{

  cout << "CAADlgHelloWindow::~CAADlgHelloWindow" << endl;

  _pHelloApplication = NULL ;

}

//--------------------------------------------------------------------------------------

void CAADlgHelloWindow::Build()

{

  cout << "CAADlgHelloWindow::Build" << endl;

  // The text

  CATDlgLabel * pLabel = new CATDlgLabel(this,"MessageId");

  // On the Close

  AddAnalyseNotificationCB(this,

                            GetWindCloseNotification(),

                           (CATCommandMethod)&CAADlgHelloWindow::Exit, NULL);

}

//--------------------------------------------------------------------------------------

void CAADlgHelloWindow::Exit(CATCommand         * iSendingCommand,

                           CATNotification    * iSentNotification,

                           CATCommandClientData iUsefulData)

{

   _pHelloApplication->Destroy();

   _pHelloApplication = NULL ;

}
发表评论0条 】
网友评论(共?条评论)..
创建CAA对话框程序的详细步骤