HeaderPane
Main
Hide
Share Link
Print

Hit Testing

SftDate_HitTest returns what is at a location of a control, in client coordinates, in a SFTDATE_HITTEST structure. Its area member tells what is at the location; for a calendar, fHasDate and date return the date there.

Fields

For an SftDate control, area is one of these values:

ValueLocation
SFTDATE_FIELDHIT_NOWHEREOutside the field.
SFTDATE_FIELDHIT_SEGMENTA part of the value that can be edited.
SFTDATE_FIELDHIT_TEXTThe text area outside a part, the text box of a field with free-form editing, or the text area of an empty field.
SFTDATE_FIELDHIT_CHECKBOXThe check box.
SFTDATE_FIELDHIT_CLEARBUTTONThe Clear button.
SFTDATE_FIELDHIT_DROPDOWNBUTTONThe dropdown button.
SFTDATE_FIELDHIT_UPBUTTON, SFTDATE_FIELDHIT_DOWNBUTTONThe up and down buttons.

The dropdown is a window of its own and is not part of the field's client area.

Calendars

For an SftCalendar control, area is one of these values:

ValueLocation
SFTDATE_CALHIT_NOWHEREOutside the calendar.
SFTDATE_CALHIT_BACKGROUNDThe background, outside the other parts.
SFTDATE_CALHIT_TITLEThe title of a month, a year, a decade or a century; date is the first date of the period.
SFTDATE_CALHIT_PREVIOUSBUTTON, SFTDATE_CALHIT_NEXTBUTTONThe previous and next buttons.
SFTDATE_CALHIT_DAYOFWEEKThe name of a day of the week.
SFTDATE_CALHIT_WEEKNUMBERA week number; date is the first date of the week's row.
SFTDATE_CALHIT_DAYA day of a month; date is the day.
SFTDATE_CALHIT_TRAILINGDAYA day of the previous or next month; date is the day.
SFTDATE_CALHIT_PERIODA month, a year or a decade in the larger views; date is the first date of the period.
SFTDATE_CALHIT_TODAYBUTTON, SFTDATE_CALHIT_CLEARBUTTONThe Today and Clear buttons.

This example shows a context menu when the user right-clicks a day:

case WM_CONTEXTMENU:
    if ((HWND) wParam == hwndCalendar) {
        POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) };
        SFTDATE_HITTEST hit;
        ScreenToClient(hwndCalendar, &pt);
        SftDate_HitTest(hwndCalendar, pt, &hit);
        if (hit.area == SFTDATE_CALHIT_DAY && hit.fHasDate)
            ShowDayMenu(hwndDlg, &hit.date);               /* the application's menu */
        return TRUE;
    }
    break;

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