Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Report Control
  New Posts New Posts RSS Feed - Drag-n-Drop bug
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Drag-n-Drop bug

 Post Reply Post Reply
Author
Message
larryp View Drop Down
Groupie
Groupie


Joined: 15 January 2005
Location: United States
Status: Offline
Points: 61
Post Options Post Options   Thanks (0) Thanks(0)   Quote larryp Quote  Post ReplyReply Direct Link To This Post Topic: Drag-n-Drop bug
    Posted: 22 October 2005 at 3:55pm
Drag-n-Drop bug.

In the routine CXTPReportControl::OnMouseMove exists the following code:

        // If mouse moved some since down...
        if (m_bPrepareDrag && (labs (point.x - m_pointDrag.x) > 3 ||
            labs (point.x - m_pointDrag.x) > 3))
        {
            // Prevent duplicate
            m_bPrepareDrag = FALSE;

            // Begin a drag operation
            OnBeginDrag(m_pointDrag);
       }

There are two identical checks for point.x - m_pointDrag.x.  It seems that the second one should be point.y - m_pointDrag.y

This prevents rows from being dragged unless the mouse is moved horizontally greater than three.


Back to Top
gshawn View Drop Down
Senior Member
Senior Member


Joined: 04 October 2004
Status: Offline
Points: 227
Post Options Post Options   Thanks (0) Thanks(0)   Quote gshawn Quote  Post ReplyReply Direct Link To This Post Posted: 22 October 2005 at 4:36pm
I thought the Report Control didn't support drag and drop?
Back to Top
larryp View Drop Down
Groupie
Groupie


Joined: 15 January 2005
Location: United States
Status: Offline
Points: 61
Post Options Post Options   Thanks (0) Thanks(0)   Quote larryp Quote  Post ReplyReply Direct Link To This Post Posted: 24 October 2005 at 8:50am
If you have a view class derived from CXTPReportView, then the report control supports standard MFC drag-n-drop behavior.  The report control will not perform the drag-n-drop for you but you get the standard messages such that you can implement it in your view class.

You need to add the following routines in your view class:

    virtual DROPEFFECT OnDragEnter(COleDataObject* pDataObject, DWORD dwKeyState, CPoint point );
    virtual DROPEFFECT OnDragOver(COleDataObject* pDataObject, DWORD dwKeyState, CPoint point );
    virtual DROPEFFECT OnDropEx(COleDataObject* pDataObject, DROPEFFECT dropDefaultEffect, DROPEFFECT dropListEffect, CPoint point);
    virtual void OnDragLeave();
    afx_msg void OnReportBeginDrag(NMHDR * pNotifyStruct, LRESULT * result);

Also you need to add:
    ON_NOTIFY(LVN_BEGINDRAG, XTP_ID_REPORT_CONTROL, OnReportBeginDrag)   

Your code has to copy your records to the clipboard and paste them into your report control, but it can be done.

--Larry


Back to Top
gshawn View Drop Down
Senior Member
Senior Member


Joined: 04 October 2004
Status: Offline
Points: 227
Post Options Post Options   Thanks (0) Thanks(0)   Quote gshawn Quote  Post ReplyReply Direct Link To This Post Posted: 31 October 2005 at 7:25pm

Thanks Larry, I did not realize this is the MFC forum. :(

I was under the impression this feature would be in the ActiveX version a while ago, I was wondering if I had just missed it... still no luck in the ActiveX version, and apparently to get it to work in MFC you have to use a hack. The lack of drag and drop support is a pretty huge oversight imho.

Anyway, thanks for the reply.

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down



This page was generated in 0.125 seconds.