void CSketcherView::OnElementDelete() { if(m_pSelected) { CSketcherDoc* pDoc = GetDocument();// Get the document pointer pDoc->DeleteElement(m_pSelected); // Delete the element pDoc->UpdateAllViews(nullptr); // Redraw all the views m_pSelected = nullptr; // Reset selected element ptr } }