SftTree/DLL 7.5 - Tree Control
SftBox/OCX 5.0 - Combo Box Control
SftButton/OCX 3.0 - Button Control
SftMask/OCX 7.0 - Masked Edit Control
SftTabs/OCX 6.5 - Tab Control (VB6 only)
SftTree/OCX 7.5 - Tree Control
SftPrintPreview/DLL 2.0 - Print Preview Control (discontinued)
SftTree/DLL 7.5 - Tree Control
SftBox/OCX 5.0 - Combo Box Control
SftButton/OCX 3.0 - Button Control
SftDirectory 3.5 - File/Folder Control (discontinued)
SftMask/OCX 7.0 - Masked Edit Control
SftOptions 1.0 - Registry/INI Control (discontinued)
SftPrintPreview/OCX 1.0 - Print Preview Control (discontinued)
SftTabs/OCX 6.5 - Tab Control (VB6 only)
SftTree/OCX 7.5 - Tree Control
SftTabs/NET 6.0 - Tab Control (discontinued)
SftTree/NET 2.0 - Tree Control
This section describes how to use SftButton/DLL in an application written using C++ and the Microsoft Foundation Class library (MFC).
Please see "Building Applications" to prepare a project for development with SftButton/DLL.
| A) | Every source program making use of a SftButton/DLL control must include the required header file SftButton.h by using the #include directive. |
|---|
#include "SftButton.h" /* SftButton/DLL required header file */
This include statement should appear after the #include <stdafx.h> statement or can be included at the end of stdafx.h.
| B) | The source program SftButtonM.CPP must be added to your project. It is added to the project, without making any modifications to the file. Instead of adding it to the project, you can include the file using the #include directive. However, it must be included in a source file (*.CPP) as it is not a header file, and only one source file can #include the file SftButtonM.CPP. |
|---|
#include "SftButtonM.cpp"
| C) | In order to use SftButton/DLL controls, an application must call the CSftButton::RegisterApp function. The preferred location is the InitInstance member function of your CWinApp-based application object: |
|---|
CSftButton::RegisterApp(); /* Use SftButton/DLL with this application */| D) | Once SftButton/DLL controls are no longer needed, an application must call the CSftButton::UnregisterApp function. The preferred location is the ExitInstance member function of your CWinApp-based application object: |
|---|
CSftButton::UnregisterApp(); /* No longer use SftButton/DLL */| E) | The application's executable (Exe or Dll) must be linked with the correct Lib file, depending on the target environment. Please see "Building Applications" for more information. |
|---|
ClassWizard does not support new classes such as CSftButton, so any button control instance variables, notification handlers, message map entries, etc., have to be added manually.
There are two methods to add a button control to an application:
Adding a button control using dialog resources is accomplished by using a resource editor to design a dialog. For more information, see Creating a Dialog Resource. Once a button control is created, its CSftButton-based object can be obtained by using the Windows GetDlgItem function or attached to a CSftButton object using SubclassDlgItem:
CSftButton * pButton; pButton = (CSftButton *) GetDlgItem(IDC_BUTTON);
or
CSftButton m_Button;
m_Button.SubclassDlgItem(IDC_BUTTON, this);Another method to create a button control is by using the CSftButton::Create member function.
CSftButton m_Button; m_Button.Create(WS_CHILD | WS_VISIBLE | WS_TABSTOP, CRect(10,10,130,42), pParentWnd, IDC_BUTTON);
As with standard Windows controls, applications must respond to events and messages to cause controls to respond to user requests. For additional information, see Notifications.
// Event handler prototype added to dialog/window class
afx_msg void OnButtonClicked();
// Event handler(s) added to message map
BEGIN_MESSAGE_MAP(CSampleDialog, CDialog)
ON_BN_CLICKED(IDC_BUTTON, OnButtonClicked)
END_MESSAGE_MAP()
// Event handler implementation
void CSampleDialog::OnButtonClicked()
{
// respond to the click
}If the button has an attached dropdown arrow, clicks on the arrow are delivered as SFTBUTTONN_DROPDOWNCLICK. Use ON_SFTBUTTONN_DROPDOWNCLICK in the message map.
