HeaderPane
Main
Hide

SftMask/DLL 7.0 - Masked Edit Control

Share Link
Print

Default Text

The masked edit control can automatically fill an empty control with a default value, defined using the lpszDefaultText field of the SFTMASK_CONTROL structure.

The default text is entered as if typed - each character is validated against the edit mask, so it must fit the mask.

The following special values are supported (case-insensitive):

=TodayToday's date (and time) is entered into the date/time fields of the mask.
=YesterdayYesterday's date is entered.
=TomorrowTomorrow's date is entered.
=NowThe current date and time is entered.

The iDefaultStyle field defines when the default text is applied:

SFTMASK_DEFAULT_IMMEDIATEThe moment the contents become empty, including while the user is editing - deleting all input instantly restores the default. This is the default setting.
SFTMASK_DEFAULT_DELAYEDApplied only when the empty control loses the input focus, so the user can clear the field and type something else without the default snapping back mid-edit.

An application can apply the default text at any time using the SetDefaultValue function.

SFTMASK_CONTROL Ctl;
Ctl.cbSize = sizeof(SFTMASK_CONTROL);
SftMask_GetControlInfo(hwndCtl, &Ctl);
Ctl.lpszMask = (LPTSTR) TEXT("$D");
Ctl.lpszDefaultText = (LPTSTR) TEXT("=Today");
Ctl.iDefaultStyle = SFTMASK_DEFAULT_IMMEDIATE;
SftMask_SetControlInfo(hwndCtl, &Ctl);

See Also SetDefaultValue | SFTMASK_DEFAULT Constants | Edit Masks | SFTMASK_CONTROL


Last Updated 08/30/2026 - (email)
© 2026 Softel vdm, Inc.