R
Rajko
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->BeginDrag(0, CPoint(0,8));
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);
}
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->BeginDrag(0, CPoint(0,8));
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);
}