Mouse Event wird nicht angenommen
-
Hallo
Habe eine eigene Klasse von CButton abgeleitet und möchte gerne das mouse Event "Linke Taste gedrückt" auswerten. Habe dazu auch die Message überschrieben. Leider reagiert der Dialog in dem der Button eingefügt wurde nie auf dieses Event. Habe auch einen Haltepunkt eingefügt (Zeile 57) und es wird nie angehalten. Müsste ich irgendwas anders machen?
CMyButton.h
#pragma once #include "ProfilPoint.h" // CMyButton class CMyButton : public CButton { DECLARE_DYNAMIC(CMyButton) public: CMyButton(); CMyButton(CList<ProfilPoint> &pointList); virtual ~CMyButton(); CList<ProfilPoint> *m_PointList; afx_msg void OnPaint(); afx_msg void OnLButtonDown(UINT nFlags, CPoint point); protected: DECLARE_MESSAGE_MAP() private: int x,y,zeile,spalte; };CMyButton.cpp
// MyButton.cpp : implementation file // #include "stdafx.h" #include "WingCut.h" #include "MyButton.h" #include "ExtendedEdit.h" #include "ProfilPoint.h" // CMyButton IMPLEMENT_DYNAMIC(CMyButton, CButton) CMyButton::CMyButton() { } CMyButton::CMyButton(CList<ProfilPoint> &pointList) { m_PointList = &pointList; zeile=spalte=1; } CMyButton::~CMyButton() { } BEGIN_MESSAGE_MAP(CMyButton, CButton) ON_WM_PAINT() ON_WM_LBUTTONDOWN() END_MESSAGE_MAP() // CMyButton message handlers void CMyButton::OnPaint() { CButton::OnPaint(); Invalidate(TRUE); CPaintDC dc(this); RECT frameRect; GetWindowRect(&frameRect); x=frameRect.right-frameRect.left; y=frameRect.top-frameRect.bottom; dc.TextOutA(spalte*x/2,zeile*20,"2"); } void CMyButton::OnLButtonDown(UINT nFlags, CPoint point) { // TODO: Add your message handler code here and/or call default Invalidate(TRUE); if (point.y <= m_PointList->GetCount()*20) { zeile = point.y/20; spalte = 2*point.x/x; } CButton::OnLButtonDown(nFlags, point); }