COptionTreeItem* COptionTree::FindItem(const POINT& pt) { // Delcare variables COptionTreeItem* otiItem; CPoint ptPoint = pt; CPoint ptLoc; // Convert screen to tree coordinates ptPoint.y += m_ptOrigin.y; // Search the visible list for the item for (otiItem = m_otiVisibleList; otiItem; otiItem = otiItem->GetNextVisible()) { // -- Get item location ptLoc = otiItem->GetLocation(); if (ptPoint.y >= ptLoc.y && ptPoint.y < ptLoc.y + otiItem->GetHeight()) { return otiItem; } } return NULL; }