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 the C programming language.
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 <windows.h> statement. The file is located in the directory \Program Files (x86)\Softelvdm\SftButton DLL 3.0\Include (unless changed during the installation). The project settings may need to be updated so the #include file can be located (see "Building Applications" for more information).
| B) | In order to use SftButton/DLL controls, an application must call the SftButton_RegisterApp function. The call to this function is required so that SftButton/DLL window classes can be registered. This call has to be made before any SftButton/DLL controls are created. Add the following statement to your source code, where your application registers its window classes (normally during application initialization): |
|---|
SftButton_RegisterApp(hInstance); /* Use SftButton/DLL with this application */| C) | Once SftButton/DLL controls are no longer needed, an application must call the SftButton_UnregisterApp function. The call to this function is required so that SftButton/DLL window classes can be unregistered and cleanup processing can take place. This call has to be made after all SftButton/DLL controls have been destroyed (normally during application termination). |
|---|
SftButton_UnregisterApp(hInstance); /* No longer use SftButton/DLL */| D) | 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. |
|---|
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. Once a button control is created, its window handle can be obtained by using the Windows GetDlgItem function. For more information, see Creating a Dialog Resource.
Another method to create a button control is by using the CreateWindow(Ex) Windows call:
hwndButton = CreateWindow(TEXT(SFTBUTTON_CLASS), NULL, WS_CHILD | WS_VISIBLE | WS_TABSTOP, 0, 0, 120, 32, hwndMain, (HMENU) IDC_BUTTON, hInstance, NULL);
For more information on the various parameters used, see the Windows API documentation.
A newly created button control is configured using SftButton_SetControlInfo. Populate a SFTBUTTON_CONTROL structure with the desired images, text, colors, border style, theme and behavior flags, then pass it to SftButton_SetControlInfo.
SFTBUTTON_CONTROL Ctl; ZeroMemory(&Ctl, sizeof(Ctl)); Ctl.cbSize = sizeof(Ctl); Ctl.nBorderStyle = SFTBUTTON_BORDER_STANDARD; Ctl.nUseThemes = SFTBUTTON_THEME_YES; Ctl.nDarkMode = SFTBUTTON_DARKMODE_AUTO; Ctl.nHighContrastMode = SFTBUTTON_HIGHCONTRAST_AUTO; /* populate Text, Picture1, colors, etc. */ SftButton_SetControlInfo(hwndButton, &Ctl);
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.
Respond to the WM_COMMAND / BN_CLICKED notification just as you would for a standard Windows push button:
case WM_COMMAND: {
int id = LOWORD(wParam);
int code = HIWORD(wParam);
switch (id) {
case IDC_BUTTON:
if (code == BN_CLICKED)
DoButtonAction();
break;
}
break;
}If the button has an attached dropdown arrow (fShowDropDown is TRUE), clicks on the arrow are delivered as SFTBUTTONN_DROPDOWNCLICK instead of BN_CLICKED. Handle them through the same WM_COMMAND switch.
