Print Page | Close Window

Drag-n-Drop bug

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Report Control
Forum Description: Topics Related to Codejock Report Control
URL: http://forum.codejock.com/forum_posts.asp?TID=3082
Printed Date: 27 November 2024 at 4:03am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Drag-n-Drop bug
Posted By: larryp
Subject: Drag-n-Drop bug
Date 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.





Replies:
Posted By: gshawn
Date Posted: 22 October 2005 at 4:36pm
I thought the Report Control didn't support drag and drop?


Posted By: larryp
Date 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




Posted By: gshawn
Date 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.




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net