Defines the days of the week the user cannot select.
C
int WINAPI SftDate_GetDisabledDaysOfWeek(HWND hwndCtl); BOOL WINAPI SftDate_SetDisabledDaysOfWeek(HWND hwndCtl, int days);
C++
int CSftDate::GetDisabledDaysOfWeek() const; int CSftCalendar::GetDisabledDaysOfWeek() const; BOOL CSftDate::SetDisabledDaysOfWeek(int days); BOOL CSftCalendar::SetDisabledDaysOfWeek(int days);
hwndCtl
The window handle of the month calendar control (SftCalendar), or of the date field control (SftDate) whose dropdown calendar is affected.
days
A combination of the following values:
| SFTDATE_DAYS_NONE | No day is disabled. This is the default. |
| SFTDATE_DAYS_SUNDAY, SFTDATE_DAYS_MONDAY, SFTDATE_DAYS_TUESDAY, SFTDATE_DAYS_WEDNESDAY, SFTDATE_DAYS_THURSDAY, SFTDATE_DAYS_FRIDAY, SFTDATE_DAYS_SATURDAY | The day of the week. |
| SFTDATE_DAYS_WEEKEND | Saturday and Sunday. |
GetDisabledDaysOfWeek returns the combination of disabled days.
SetDisabledDaysOfWeek returns TRUE if days holds only the values listed above, otherwise FALSE.
The GetDisabledDaysOfWeek and SetDisabledDaysOfWeek functions define and retrieve the days of the week a calendar shows disabled (SFTDATE_COLOR_DISABLEDFORE). The user cannot select them.
Single days are disabled using special dates (SFTDATE_SPECIALDATE, fEnabled) or the NM_SFTDATE_DAYFORMATTING notification. A value typed into a date field control is not limited by disabled days; the NM_SFTDATE_VALUEVALIDATING notification can refuse it.
The setting applies to a month calendar control and to the dropdown calendar of a date field control.
break;
case IDC_WEEKENDS:
// NM_SFTDATE_DAYFORMATTING colors the days; RefreshDays asks for them again
for (i = 0; i < CONTROLS; ++i)
SftDate_RefreshDays(c[i]);
break;
case IDC_DISABLEWEEKENDS:
for (i = 0; i < CONTROLS; ++i)
SftDate_SetDisabledDaysOfWeek(c[i], fChecked ? SFTDATE_DAYS_WEEKEND : SFTDATE_DAYS_NONE);
break;
case IDC_RANGESELECT:
SftDate_SetSelectionMode(hwndCal, fChecked ? SFTDATE_SELECTION_RANGE : SFTDATE_SELECTION_SINGLE);
ShowSelection(hwndDlg);
break;
case IDC_THISYEAR: {
SYSTEMTIME today, first, last;
break;
case IDC_WEEKENDS:
// NM_SFTDATE_DAYFORMATTING colors the days; RefreshDays asks for them again
for (int i = 0; i < CONTROLS; ++i)
Control(i).RefreshDays();
break;
case IDC_DISABLEWEEKENDS:
for (int i = 0; i < CONTROLS; ++i)
Control(i).SetDisabledDaysOfWeek(fChecked ? SFTDATE_DAYS_WEEKEND : SFTDATE_DAYS_NONE);
break;
case IDC_RANGESELECT:
m_Calendar.SetSelectionMode(fChecked ? SFTDATE_SELECTION_RANGE : SFTDATE_SELECTION_SINGLE);
ShowSelection();
break;
case IDC_THISYEAR: {
SYSTEMTIME today;See Also C/C++ API | Categories | Notifications