HeaderPane
Main
Hide
Share Link
Print

ShowClearButton

Defines whether a date field control shows a Clear button.

C

BOOL WINAPI SftDate_GetShowClearButton(HWND hwndCtl);
void WINAPI SftDate_SetShowClearButton(HWND hwndCtl, BOOL fShow);

C++

BOOL CSftDate::GetShowClearButton() const;
void CSftDate::SetShowClearButton(BOOL fShow);

Parameters

hwndCtl

The window handle of the date field control (SftDate).

fShow

TRUE to show the Clear button, otherwise FALSE.

Returns

GetShowClearButton returns TRUE if the Clear button is shown, otherwise FALSE.

Comments

The GetShowClearButton and SetShowClearButton functions define and retrieve whether a date field control shows a Clear button (an x) in front of its other buttons. The default is FALSE.

The button appears while the field has a value and is enabled. Clicking it empties the field if it allows an empty value (SetAllowEmpty), after the NM_SFTDATE_VALUEVALIDATING notification; otherwise it clears the check box (SetShowCheckBox).

The Clear button of the dropdown calendar is defined using SetCalendarClearButton. This function applies to the date field control only. For a month calendar control, GetShowClearButton returns FALSE and SetShowClearButton has no effect.

Examples

C View entire sample code

    SftDate_SetSelectionMode(GetDlgItem(hwndDlg, IDC_RANGE), SFTDATE_SELECTION_RANGE);
    SftDate_SetRange(GetDlgItem(hwndDlg, IDC_RANGE), &now, &weekLater);

    SftDate_SetShowCheckBox(GetDlgItem(hwndDlg, IDC_OPTIONAL), TRUE);
    SftDate_SetChecked(GetDlgItem(hwndDlg, IDC_OPTIONAL), FALSE);

    SftDate_SetAllowEmpty(GetDlgItem(hwndDlg, IDC_EMPTY), TRUE);
    SftDate_SetPlaceholderText(GetDlgItem(hwndDlg, IDC_EMPTY), TEXT("No date"));
    SftDate_SetShowClearButton(GetDlgItem(hwndDlg, IDC_EMPTY), TRUE);
    SftDate_SetValue(GetDlgItem(hwndDlg, IDC_EMPTY), NULL);

    SftDate_SetEditStyle(GetDlgItem(hwndDlg, IDC_FREEFORM), SFTDATE_EDIT_FREEFORM);

    SftDate_SetCustomFormat(GetDlgItem(hwndDlg, IDC_CUSTOM), TEXT("ddd, MMM d, yyyy 'at' HH:mm"));
    SftDate_SetFormat(GetDlgItem(hwndDlg, IDC_CUSTOM), SFTDATE_FORMAT_CUSTOM);

C++ View entire sample code

    m_Fields[5].SetSelectionMode(SFTDATE_SELECTION_RANGE);
    m_Fields[5].SetRange(&now, &weekLater);

    m_Fields[6].SetShowCheckBox(TRUE);
    m_Fields[6].SetChecked(FALSE);

    m_Fields[7].SetAllowEmpty(TRUE);
    m_Fields[7].SetPlaceholderText(_T("No date"));
    m_Fields[7].SetShowClearButton(TRUE);
    m_Fields[7].SetValue(NULL);

    m_Fields[8].SetEditStyle(SFTDATE_EDIT_FREEFORM);

    m_Fields[9].SetCustomFormat(_T("ddd, MMM d, yyyy 'at' HH:mm"));
    m_Fields[9].SetFormat(SFTDATE_FORMAT_CUSTOM);

See Also C/C++ API | Categories | Notifications


Last Updated 11/26/2026 - (email)
© 2026 Softel vdm, Inc.