HeaderPane
Main
Hide
Share Link
Print

ShowCheckBox

Defines whether a date field control shows a check box.

C

BOOL WINAPI SftDate_GetShowCheckBox(HWND hwndCtl);
void WINAPI SftDate_SetShowCheckBox(HWND hwndCtl, BOOL fShow);

C++

BOOL CSftDate::GetShowCheckBox() const;
void CSftDate::SetShowCheckBox(BOOL fShow);

Parameters

hwndCtl

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

fShow

TRUE to show the check box, otherwise FALSE.

Returns

GetShowCheckBox returns TRUE if the check box is shown, otherwise FALSE.

Comments

The GetShowCheckBox and SetShowCheckBox functions define and retrieve whether a date field control shows a check box in front of its value, for an optional date. The default is FALSE.

While the check box is cleared (SetChecked), the field has no value: GetValue returns FALSE and the value is shown dimmed. The user toggles the check box with a click or the Space key; while it is cleared, typing is ignored. Choosing a date in the dropdown or setting a value (SetValue) checks it. The field keeps its date while the check box is cleared.

Showing or hiding the check box sends the NM_SFTDATE_VALUECHANGED notification if it changes whether the field has a value. This function applies to the date field control only. For a month calendar control, GetShowCheckBox returns FALSE and SetShowCheckBox has no effect.

Examples

C View entire sample code

    SftDate_SetFormat(GetDlgItem(hwndDlg, IDC_TIMECLOCK), SFTDATE_FORMAT_SHORTTIME);
    SftDate_SetTimeDropDownStyle(GetDlgItem(hwndDlg, IDC_TIMECLOCK), SFTDATE_TIMESTYLE_CLOCK);

    SftDate_SetFormat(GetDlgItem(hwndDlg, IDC_DATETIME), SFTDATE_FORMAT_SHORTDATETIME);

    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);

C++ View entire sample code

    m_Fields[3].SetFormat(SFTDATE_FORMAT_SHORTTIME);
    m_Fields[3].SetTimeDropDownStyle(SFTDATE_TIMESTYLE_CLOCK);

    m_Fields[4].SetFormat(SFTDATE_FORMAT_SHORTDATETIME);

    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);

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


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