|
Hello friends
MFC application in which I m creating two Ruler bar which contains different color are object of same class rulerWnd. Now, am handling Mouse procedure on rulerWnd[lButtondown,up,mouseMove] are working Fine If i used to drag and drop some color to same ruler bar.
But If i have to drag some color from one ruler bar to another then it is dropping on same ruler. when i drop on other ruler from first then I checked on LbuttonUp that Point values are coming in negative and its dropping on same ruler even if my mouse LButton ups on another.
How can i handle two Windows mouse procedure at same time.
Any Ideas?
here is sample code that I am trying.
OnLButtonDown(UINT nFlags, CPoint point)
{
case SELECT_COPY:
{
if(m_dwStyle == ruler1|| m_dwStyle == ruler2)
{
GetWindowRect(&rect);
ClipCursor(NULL);
SetCapture();
if(m_szSelectIndexRange.cx>-1 && m_szSelectIndexRange.cy>-1) {
int nSelIndex;
if(m_dwStyle == ruler1)
{
nSelIndex = point.x + m_lScrollPos;
nSelIndex /= fWarpUnit;
}
else
{
nSelIndex = m_nSize-(rect.Height()-point.y)-m_lScrollPos;
nSelIndex /= fWeftUnit;
}
if(nSelIndex >= m_szSelectIndexRange.cx && nSelIndex <= m_szSelectIndexRange.cy)
{
m_bSelectDrag = TRUE;
::SetCursor(AfxGetApp()->LoadCursor(IDC_DRAG_CURSOR));
}
}
}
}; break;
}
OnMouseMove(UINT nFlags, CPoint point)
case SELECT_COPY:
{
if(m_bSelectDrag)
{
CRect rectWnd, invalidRect;
GetClientRect(&rectWnd);
if(m_dwStyle == ruler2)
{
m_lPaintEndPos = point.y; invalidRect = CRect(0, point.y-50- (m_szSelectIndexRange.cy-m_szSelectIndexRange.cx)*m_fStep*pDoc->GetZoomValue(), 22, \
point.y +50);
}
else
{
m_lPaintEndPos = point.x + m_lScrollPos;
invalidRect = CRect(m_lPaintEndPos-50, 0, \
m_lPaintEndPos+50+(m_szSelectIndexRange.cy-m_szSelectIndexRange.cx)*m_fStep*pDoc->GetZoomValue(), 22);
}
InvalidateRect(&invalidRect, FALSE);
}
else SelectStripe(point);
}; break;
OnLButtonUP(UINT nFlags, CPoint point)
case SELECT_COPY:
ClipCursor(NULL);
if(m_bSelectDrag)
{
CopyStripe(point);
m_bSelectDrag = FALSE;
}
else SelectStripe(point);
break;
|
|
|
|
|
As I Come to know that SetCapture is creating problem.I am using setCapture on LButtondown and Releasing it on LButtonUP.
But While dragging, I want to release it as Mouse moved on another ruler2 So that it capture to ruler2 and if mouse come back to ruler1, i want to capture to it.
Any Ideas?
Thanks.
|
|
|
|