Firing the ClickOut Event

ClickOut fires under a condition opposite to the condition that fires ClickIn. You must modify the OnLButtonDown function in CIRCCTL.CPP to call FireClickOut when the insertion point is not within the circle (that is, the InCircle function returns FALSE). The FireClickOut function fires the event.

Add the following lines of code to CIRCCTL.CPP:

    else
        // Fire the ClickOut event
        FireClickOut();

as shown in the code example:

void CCircCtrl::OnLButtonDown(UINT nFlags, CPoint point)
{
    CDC*    pdc;

    // Flash the color of the control if within the ellipse.
    if (InCircle(point))
    {
        pdc = GetDC();
        FlashColor(pdc);
        ReleaseDC(pdc);

        // Fire the ClickIn event
        FireClickIn(point.x, point.y);
    }
    else
        // Fire the ClickOut event
        FireClickOut();

    COleControl::OnLButtonDown(nFlags, point);
}