Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Report Control
  New Posts New Posts RSS Feed - [solved] BUG: Drag&Drop in v17.3.0 not working
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

[solved] BUG: Drag&Drop in v17.3.0 not working

 Post Reply Post Reply
Author
Message
mgampi View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14 July 2003
Status: Offline
Points: 1198
Post Options Post Options   Thanks (0) Thanks(0)   Quote mgampi Quote  Post ReplyReply Direct Link To This Post Topic: [solved] BUG: Drag&Drop in v17.3.0 not working
    Posted: 29 May 2017 at 9:37am
Hi;
I'm using Toolkit 17.3.0 and in ReportSample application / Quality assurance / Drag & Drop drag and drop is definitely not working. Nothing happens there?
What's the problem?
Martin

Product: Xtreme Toolkit v 19.0.0, new Projects v 19.1.0
Platform: Windows 10 v 1909 (64bit)
Language: VC++ 2017
Back to Top
mgampi View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14 July 2003
Status: Offline
Points: 1198
Post Options Post Options   Thanks (0) Thanks(0)   Quote mgampi Quote  Post ReplyReply Direct Link To This Post Posted: 29 May 2017 at 10:42am
Hi;

It took me several hours to find out that Drag&Drop in v17.3.0 is no longer working. The ReportSample > Quality Assurance > Drag&Drop example shows the same faulty behaviour.
Problem is in code of CXTPReportControl::OnDrop, line 4989:

    if (m_bInternalDrag && dropEffect == DROPEFFECT_MOVE)
    {
        m_bInternalMove = TRUE;

        if (nDropPos == -1)
            return FALSE;

        BOOL bRedraw = FALSE;
        if (!m_bNoNeedSortedDragDrop && m_bSortedDragDrop && GetColumns()->GetGroupsOrder()->GetCount() == 0)
        {
            ReleaseSorted();
            bRedraw = TRUE;
        }

        pDropRecords = new CXTPReportRecords(TRUE);
        if (/*!iValid && */(!_GetSelectedRows(pDropRecords) || pDropRecords->GetCount() == GetRows()->GetCount()))
        {
            CMDTARGET_RELEASE(pDropRecords);
            return FALSE;
        }

        if (bRedraw)
        {
            Populate();
            RedrawControl();
        }
    


At the red marked position iValid is always 1 (it's the result of the XTP_NM_REPORT_HASVALIDDROPTYPE message). If it would be 0 the function returns immediately at line 4934. Therefore the dropped records collection is never filled!

Please fix this before releasing 18.0!
Martin

Product: Xtreme Toolkit v 19.0.0, new Projects v 19.1.0
Platform: Windows 10 v 1909 (64bit)
Language: VC++ 2017
Back to Top
olebed View Drop Down
Admin Group
Admin Group


Joined: 01 July 2014
Location: Ukraine
Status: Offline
Points: 841
Post Options Post Options   Thanks (0) Thanks(0)   Quote olebed Quote  Post ReplyReply Direct Link To This Post Posted: 29 May 2017 at 11:27am
Hello Martin,

I have checked that sample and it works under win8.1(x64), VS2015, x86 and x64 ToolkitProlib.
Please describe your environment. Steps to reproducing and other things which can help.

Regards,
 Oleksandr Lebed
Back to Top
mgampi View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14 July 2003
Status: Offline
Points: 1198
Post Options Post Options   Thanks (0) Thanks(0)   Quote mgampi Quote  Post ReplyReply Direct Link To This Post Posted: 29 May 2017 at 11:41am
Hi;

take a look at this:

http://forum.codejock.com/forum_posts.asp?TID=23346&PID=75810&title=bug-dragdrop-in-v1730-not-working#75810

I use windows 8.1, VS2008, 32bit application compiled with UNICODE defined
Both controls on the sample do nothing! Neither start drag nor drop!
Martin

Product: Xtreme Toolkit v 19.0.0, new Projects v 19.1.0
Platform: Windows 10 v 1909 (64bit)
Language: VC++ 2017
Back to Top
mgampi View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14 July 2003
Status: Offline
Points: 1198
Post Options Post Options   Thanks (1) Thanks(1)   Quote mgampi Quote  Post ReplyReply Direct Link To This Post Posted: 29 May 2017 at 12:05pm
Hi;

Here are parts of my code:

INITIALIZATION
    FacilityCtrl_.SetTheme(xtpReportThemeResource);

  FacilityCtrl_.GetToolTipContext()->SetStyle(xtpToolTipResource);

  FacilityCtrl_.ShowHeader(FALSE);
  FacilityCtrl_.SetGridStyle(FALSE, xtpReportGridNoLines);
  FacilityCtrl_.SetGridStyle(TRUE, xtpReportGridNoLines);

  FacilityCtrl_.InitialSelectionEnable(FALSE);
  CXTPReportColumn* pCol=FacilityCtrl_.AddColumn(new CXTPReportColumn(GetColumns()->GetCount(), _T(""), 200, TRUE));
FacilityCtrl_.GetColumns()->GetSortOrder()->Clear();

  FacilityCtrl_.GetRecords()->SetCaseSensitive(FALSE);
  FacilityCtrl_.GetPaintManager()->m_bShadeSortColumn=FALSE;

  FacilityCtrl_.AssignIconViewPropNumAndIconNum(-1, -1, TRUE, 20);
  FacilityCtrl_.GetPaintManager()->m_iRecOrRowStart=1;
  FacilityCtrl_.GetPaintManager()->m_bRecOrRowNum=FALSE;

  FacilityCtrl_.AllowEdit(FALSE);

  DropFormat_=FacilityCtrl_.EnableDragDrop(L"ReOrderFacilitiesFormat", xtpReportAllowDrop|xtpReportAllowDragMove|xtpReportDontDropAsText);


And my callbacks:
void CMyDlg::OnValidDropTargetRequest( NMHDR* /*Hdr*/, LRESULT* Result ) {
  *Result=1;
}

void CMyDlg::OnValidDropTypeRequest( NMHDR* Hdr, LRESULT* Result ) {
  XTP_NM_REPORTDRAGDROP* Data=reinterpret_cast<XTP_NM_REPORTDRAGDROP*>(Hdr);
  if (Data->pDataObject)
    *Result=Data->pDataObject->IsDataAvailable(DropFormat_);
  else
    *Result=0;
}


Nothing else - except filling several records (about 50) to the control and populate.
When removing the red part as shown in my initial post, everything works as expected.
BTW: I use d&d only in the same control to reorder rows.
Martin

Product: Xtreme Toolkit v 19.0.0, new Projects v 19.1.0
Platform: Windows 10 v 1909 (64bit)
Language: VC++ 2017
Back to Top
olebed View Drop Down
Admin Group
Admin Group


Joined: 01 July 2014
Location: Ukraine
Status: Offline
Points: 841
Post Options Post Options   Thanks (0) Thanks(0)   Quote olebed Quote  Post ReplyReply Direct Link To This Post Posted: 01 June 2017 at 7:30am
Originally posted by mgampi mgampi wrote:

        if (/*!iValid && */(!_GetSelectedRows(pDropRecords) || pDropRecords->GetCount() == GetRows()->GetCount()))
        {
            CMDTARGET_RELEASE(pDropRecords);
            return FALSE;
        }
    

At the red marked position iValid is always 1

So when iValid is 1 then  this condition doesn't work and  DROP operation continue to execute. This code works from 2009 year and I can't found such problems with XTP_NM_REPORT_HASVALIDDROPTYPE.
Back to Top
mgampi View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14 July 2003
Status: Offline
Points: 1198
Post Options Post Options   Thanks (0) Thanks(0)   Quote mgampi Quote  Post ReplyReply Direct Link To This Post Posted: 01 June 2017 at 7:38am
Hello;

The Problem is, that _GetSelectedRows(pDropRecords) is not called because !iValid is ALWAYS FALSE and the second part of the if condition is not further examined!
Therefore the succeeding code has no valid records in the pDropRecords collection.

We can reproduce the error on all of our machines with VS2008 up to VS2015 32bit and 64bit.
Martin

Product: Xtreme Toolkit v 19.0.0, new Projects v 19.1.0
Platform: Windows 10 v 1909 (64bit)
Language: VC++ 2017
Back to Top
olebed View Drop Down
Admin Group
Admin Group


Joined: 01 July 2014
Location: Ukraine
Status: Offline
Points: 841
Post Options Post Options   Thanks (0) Thanks(0)   Quote olebed Quote  Post ReplyReply Direct Link To This Post Posted: 01 June 2017 at 8:42am
This bug can be reproduced on our Drag'n'Drop sample only with changes of code - with introducing XTP_NM_REPORT_HASVALIDDROPTYPE callbacks. That is why I couldn't reproduce.

So fix is
if (!iValid && (!_GetSelectedRows(pDropRecords) || pDropRecords->GetCount() == GetRows()->GetCount()))

if (!_GetSelectedRows(pDropRecords) || pDropRecords->GetCount() == GetRows()->GetCount())
Back to Top
mgampi View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14 July 2003
Status: Offline
Points: 1198
Post Options Post Options   Thanks (0) Thanks(0)   Quote mgampi Quote  Post ReplyReply Direct Link To This Post Posted: 01 June 2017 at 8:46am
When you take a real close look at the code, than you see that the iValid is always one at this line of code. It can't be 0 because the method is exited in this case a few lines above. And it is not changed beween set by XTP_NM_REPORT_HASVALIDDROPTYPE and the if statement.
So I mean that it can be removed without any problems.
Martin

Product: Xtreme Toolkit v 19.0.0, new Projects v 19.1.0
Platform: Windows 10 v 1909 (64bit)
Language: VC++ 2017
Back to Top
olebed View Drop Down
Admin Group
Admin Group


Joined: 01 July 2014
Location: Ukraine
Status: Offline
Points: 841
Post Options Post Options   Thanks (0) Thanks(0)   Quote olebed Quote  Post ReplyReply Direct Link To This Post Posted: 01 June 2017 at 8:47am
I have changed my previous post before your answer Smile
Back to Top
mgampi View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14 July 2003
Status: Offline
Points: 1198
Post Options Post Options   Thanks (0) Thanks(0)   Quote mgampi Quote  Post ReplyReply Direct Link To This Post Posted: 01 June 2017 at 9:16am
Hi;

I'm still convinced that the iValid part can be completely removed!
Martin

Product: Xtreme Toolkit v 19.0.0, new Projects v 19.1.0
Platform: Windows 10 v 1909 (64bit)
Language: VC++ 2017
Back to Top
olebed View Drop Down
Admin Group
Admin Group


Joined: 01 July 2014
Location: Ukraine
Status: Offline
Points: 841
Post Options Post Options   Thanks (0) Thanks(0)   Quote olebed Quote  Post ReplyReply Direct Link To This Post Posted: 01 June 2017 at 9:19am
yes, I have already removed it.
Thank you for bringing this to our attention!
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.141 seconds.