471,089 Members | 1,126 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,089 software developers and data experts.

Drag and Drop with CListCtrl??

Here is something I find unusual.

I implemented Drag and Drop to CListCtrl.
First I created my own class myCListCtrl from CListCtrl.
I implemented OnMouseMove and OnLButtonUp message handlers in class.

Unusual :
If I don't use RedrawWindow() I get trails from m_dragImage.
and second thing is
I don't need to use DragShowNolock(FALSE) and DragShowNolock(TRUE) to
update window. If I comment these two lines it will work fine.
Of course in parent class i called dragImage->DragEnter(&m_List,
pNMLV->ptAction);
Where m_List is member of CDialog class of type myCListCtrl.

Any comments are appreciated.

Thx, Rajko.

Here is my code:

void myListCtrl::OnMouseMove(UINT nFlags, CPoint point) {
if (m_draging) {
LVHITTESTINFO lvHTI;
lvHTI.pt = point;
SubItemHitTest(&lvHTI);
if (lvHTI.flags & LVHT_ONITEMLABEL) {
if (m_posItemDrop != lvHTI.iItem) {
m_dragImage->DragShowNolock(FALSE);
// old item
SetItemState(m_posItemDrop, 0, LVIS_DROPHILITED);
m_posItemDrop = lvHTI.iItem;
// SetHotItem(m_posItemDrop);
SetItemState(m_posItemDrop, LVIS_DROPHILITED,
LVIS_DROPHILITED);
RedrawWindow();
// RedrawItems(0, GetItemCount());
m_dragImage->DragShowNolock(TRUE);
//Update(lvHTI.iItem);
}
}
// move image being dragged
m_dragImage->DragMove(point);
}
CListCtrl::OnMouseMove(nFlags, point);
}

Nov 17 '05 #1
0 1816

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Lauren Quantrell | last post: by
2 posts views Thread by SamSpade | last post: by
3 posts views Thread by Ajay Krishnan Thampi | last post: by
reply views Thread by Rajko | last post: by
reply views Thread by Victor | last post: by
6 posts views Thread by jojobar | last post: by
3 posts views Thread by VB Programmer | last post: by
1 post views Thread by Darren | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.