SftButton/DLL 3.0 - Button Control
SftTree/DLL 8.0 - Tree Control
SftBox/OCX 5.0 - Combo Box Control
SftButton/OCX 4.0 - Button Control
SftMask/OCX 7.0 - Masked Edit Control
SftTabs/OCX 6.5 - Tab Control (VB6 only)
SftTree/OCX 8.0 - Tree Control
SftButton/DLL 3.0 - Button Control
SftTree/DLL 8.0 - Tree Control
SftBox/OCX 5.0 - Combo Box Control
SftButton/OCX 4.0 - Button Control
SftMask/OCX 7.0 - Masked Edit Control
SftTabs/OCX 6.5 - Tab Control (VB6 only)
SftTree/OCX 8.0 - Tree Control
SftTree/NET 2.0 - Tree Control
The masked edit control sends notifications to its parent window. Simple notifications are sent as WM_COMMAND messages; extended notifications carrying additional data are sent as WM_NOTIFY messages with NM_SFTMASK_* structures.
WM_COMMAND notifications are cracked as usual: LOWORD(wParam) is the control ID, HIWORD(wParam) the notification code, lParam the control's window handle.
case WM_COMMAND: {
int id = LOWORD(wParam);
int code = HIWORD(wParam);
switch (id) {
case IDC_MASK:
if (code == SFTMASKN_CHANGE)
ContentsChanged();
break;
}
break;
}| Notification | Description |
|---|---|
| SFTMASKN_SETFOCUS (3) | The control received the input focus. |
| SFTMASKN_KILLFOCUS (2) | The control lost the input focus. Do not validate the contents in response to this notification (see Input Validation). |
| SFTMASKN_SIZECHANGED (4) | The control's size changed, e.g., because fAutoSize adjusted the height after a font change. |
| SFTMASKN_MOUSEMOVE (5) | The mouse moved over the control. |
| SFTMASKN_CHANGE (6) | The control's contents changed (equivalent to a standard edit control's EN_CHANGE). |
| SFTMASKN_ELLIPSECLICKED (7) | The ellipse button was clicked. There is no built-in response - the application implements the action (see Ellipse Buttons). |
| SFTMASKN_DARKMODE_CHANGED (8) | The active dark mode state flipped (SFTMASK_DARKMODE_AUTO mode only). See Dark Mode. |
| SFTMASKN_HIGHCONTRAST_CHANGED (9) | The active high contrast state flipped (SFTMASK_HIGHCONTRAST_AUTO mode only). See High Contrast. |
| SFTMASKN_DPI_CHANGED (10) | The monitor DPI changed. The host should re-send WM_SETFONT with a DPI-scaled font. See Per-Monitor DPI and Scaling. |
WM_NOTIFY notifications carry a NM_SFTMASK_* structure; lParam points to the structure, whose hdr member (NMHDR) identifies the control (hwndFrom, idFrom) and the notification (code). Members marked "modifiable" can be changed by the application before returning.
case WM_NOTIFY: {
LPNMHDR pnmh = (LPNMHDR) lParam;
if (pnmh->idFrom == IDC_MASK && pnmh->code == NM_SFTMASK_VALIDATIONERROR_CODE) {
NM_SFTMASK_VALIDATIONERROR* pErr = (NM_SFTMASK_VALIDATIONERROR*) pnmh;
// respond to the validation error
}
break;
}
typedef struct {
NMHDR hdr;
BOOL cancel; // modifiable
} NM_SFTMASK_CUSTOMVALIDATION;Sent while the control's contents are validated, allowing the application to implement its own validation logic in addition to the mask-based validation. Set cancel to TRUE to reject the contents; a NM_SFTMASK_VALIDATIONERROR notification with SFTMASK_FAILURECUSTOM follows. See Input Validation.
typedef struct {
NMHDR hdr;
LPCTSTR lpszText; // the contents being validated
int failureCode; // SFTMASK_FAILURE*
TCHAR ch; // the rejected character (input errors)
int pos; // the position (if any, otherwise -1)
} NM_SFTMASK_VALIDATIONERROR;Sent when an error condition is detected - a rejected character, a rejected delete operation, an invalid date or invalid contents during validation. failureCode identifies the condition (see SFTMASK_FAILURE Constants). See Input Validation.
typedef struct {
NMHDR hdr;
TCHAR ch; // modifiable - the operator typed
} NM_SFTMASK_INVOKINGCALCULATOR;Sent when the popup calculator is about to be displayed because the user typed an operator (+, -, * or /). Set ch to 0 to suppress the calculator. See Popup Calculator.
typedef struct {
NMHDR hdr;
BOOL fInsert; // TRUE = insert mode, FALSE = overtype mode
} NM_SFTMASK_INPUTMODEUPDATE;Sent whenever the insert/overtype mode changes, through user interaction, input focus change or application driven changes, so the application can display the current mode, e.g., in a status bar. See Insert/Overtype Mode.
typedef struct {
NMHDR hdr;
BOOL fUp; // TRUE = up button
int selStart, selEnd; // the affected input field
long countVal; // auto-repeat counter (0 = first press)
LPTSTR lpszText; // modifiable - the field text
BOOL fUpdated; // modifiable - set TRUE if the application updated lpszText
} NM_SFTMASK_UPDOWNPRESS;Sent when an up/down button is pressed (or the up/down arrow keys are used) in a numeric field. Numeric fields with a minimum/maximum range are incremented/decremented automatically; for other fields the application updates lpszText and sets fUpdated to TRUE. countVal increases while the button is held, allowing progressive increments. See Up/Down Buttons.
typedef struct {
NMHDR hdr;
BOOL fUp; // TRUE = up button
} NM_SFTMASK_UPDOWNHANDLED;Sent after the control contents have been modified using the up/down button. See Up/Down Buttons.
typedef struct {
NMHDR hdr;
int action; // SFTMASK_DROPDOWN_*
} NM_SFTMASK_DROPDOWN;Sent as the popup calendar, popup calculator or autocomplete window is shown or hidden. action identifies the popup and direction (see SFTMASK_DROPDOWN Constants).
typedef struct {
NMHDR hdr;
DATE Date; // the first day of the displayed month
} NM_SFTMASK_UPDATEMONTH;Sent every time the popup calendar displays a new month, giving the application the opportunity to highlight certain dates using SetBoldDate. See Popup Calendar.
typedef struct {
NMHDR hdr;
TCHAR ch; // modifiable
} NM_SFTMASK_CALCULATORKEYPRESS;Sent when a character is typed in the popup calculator. The application can modify or suppress (0) the character.
typedef struct {
NMHDR hdr;
UINT vk; // modifiable - virtual key code
BOOL fDown; // TRUE = key down, FALSE = key up
int cRepeat;
UINT flags;
} NM_SFTMASK_CALCULATORKEY;Sent when a key goes down or up in the popup calculator.
typedef struct {
NMHDR hdr;
TCHAR ch; // modifiable
} NM_SFTMASK_CALENDARKEYPRESS;Sent when a character is typed in the popup calendar. The application can modify or suppress (0) the character.
typedef struct {
NMHDR hdr;
UINT vk; // modifiable - virtual key code
BOOL fDown; // TRUE = key down, FALSE = key up
int cRepeat;
UINT flags;
} NM_SFTMASK_CALENDARKEY;Sent when a key goes down or up in the popup calendar.
typedef struct {
NMHDR hdr;
LPTSTR lpszText; // modifiable (SFTMASK_MAX_MASKEDTEXT length)
} NM_SFTMASK_PREPASTE;Sent before clipboard text is pasted into the control. The application can modify the text (up to SFTMASK_MAX_MASKEDTEXT characters), for example to strip formatting.
typedef struct {
NMHDR hdr;
int count; // number of matching saved entries
} NM_SFTMASK_MATCHADDCUSTOMITEMS;Sent while the autocomplete suggestion list is created or refreshed, allowing the application to add custom entries using AutoCompleteAddTop and AutoCompleteAddBottom. See AutoComplete.
typedef struct {
NMHDR hdr;
LPCWSTR lpszCurrentContents;
LPWSTR lpszSavedEntry; // modifiable
BOOL fAccept; // modifiable
} NM_SFTMASK_MATCHING;Sent for each saved entry as it is matched against the current input. The application can modify the entry or reject it by setting fAccept to FALSE. The strings are always Unicode. See AutoComplete.
typedef struct {
NMHDR hdr;
LPCTSTR lpszCurrentContents;
LPTSTR lpszSelectedEntry;// modifiable
BOOL fAccept; // modifiable
} NM_SFTMASK_MATCHACCEPT;Sent when the user selects and accepts a saved entry from the autocomplete suggestion list. The application can modify the accepted entry or reject the acceptance by setting fAccept to FALSE. See AutoComplete.
typedef struct {
NMHDR hdr;
LPCTSTR lpszCurrentContents;
LPTSTR lpszSelectedEntry;
int entryType; // value passed to AutoCompleteAddTop/AddBottom
} NM_SFTMASK_MATCHCUSTOM;Sent when the user selects and accepts a custom entry (added using AutoCompleteAddTop or AutoCompleteAddBottom). entryType is the application-defined value identifying the entry. See AutoComplete.
typedef struct {
NMHDR hdr;
BOOL fDragUsed; // modifiable
} NM_SFTMASK_DRAGSTARTING;Sent when the user starts to drag the selected text (iDragMode = SFTMASK_DRAG_MANUAL). The application implements the drag & drop operation and sets fDragUsed to TRUE. See Drag & Drop.
typedef struct {
NMHDR hdr;
UINT vk; // virtual key code
int cRepeat;
UINT flags;
BOOL fHandled; // modifiable
} NM_SFTMASK_KEYDOWN;Sent when a key goes down in the masked edit control. Set fHandled to TRUE to suppress the control's own handling.
typedef struct {
NMHDR hdr;
UINT vk; // virtual key code
int cRepeat;
UINT flags;
BOOL fHandled; // modifiable
} NM_SFTMASK_KEYUP;Sent when a key goes up in the masked edit control. Set fHandled to TRUE to suppress the control's own handling.
typedef struct {
NMHDR hdr;
TCHAR ch; // the character
int cRepeat;
BOOL fHandled; // modifiable
} NM_SFTMASK_CHAR;Sent when a character is typed in the masked edit control. Set fHandled to TRUE to suppress the control's own handling.
See Also MFC and Notifications | C/C++ API | SFTMASK_FAILURE Constants | SFTMASK_DROPDOWN Constants
