Add the Appropriate Objective Edit Classes to Your Project
The next step in integrating Objective Edit is to add the appropriate Objective Edit classes to your project. There are two ways to do this, depending on whether you are using SECEditView or SECEditCtrl.
When using SECEditView:
1. Add an SECEdit object, m_Edit, to your CDocument class.
2. Change the derivation of your class from CView to SECEditView. To do this, replace all occurrences of CView with SECEditView in the .h and .cpp files for your view class.
You must also add a method to your view class, SECEdit* GetEdit, which returns a pointer to the SECEdit object added in Step1.
NOTE >> For clipboard support, add code to initialize the OLE libraries in the application object's InitInstance(). Add a call to AfxOleInit() at the beginning of the InitInstance(). This call to AfxOleInit() is very important for clipboard support; its absence will result in inexplicable failures. For example, leaving this call out might generate the error message “CoInitialize has not been called.”
When using SECEditCtrl:
1. Add an SECEditCtrl or derivative member to your dialog class:
m_SECEditCtrl
2. In the dialog editor, place an edit control, and make a note of the ID:
IDC_SECEDITCTRL
3. In the dialog’s OnInitDialog(), call the Initialize() member function:
m_SECEditCtrl.Initialize(IDC_SECEDITCTRL, this);
Note that this procedure destroys the Edit Control and replaces it with an SECEditCtrl window, as shown in Figure 12. However, you may use the ClassWizard to handle EN_SETFOCUS and EN_KILLFOCUS, since these notifications will be sent.
Figure 12 – An SECEditCtrl in a dialog