Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Report Control
  New Posts New Posts RSS Feed - Drag & drop with virtual records
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Drag & drop with virtual records

 Post Reply Post Reply
Author
Message
Fredrik View Drop Down
Senior Member
Senior Member


Joined: 22 June 2005
Status: Offline
Points: 235
Post Options Post Options   Thanks (0) Thanks(0)   Quote Fredrik Quote  Post ReplyReply Direct Link To This Post Topic: Drag & drop with virtual records
    Posted: 24 January 2023 at 3:49am
Hi all, 

What's the trick handling drag & drop in a grid control having virtual records? I have added response handler for XTP_NM_GRID_BEGINDRAG but since I have virtual records I get the pointer to the same record regardless which one I drag. I could potentially use GetSelectedRows, but thought I should have the information needed in the XTP_NM_GRIDDRAGDROP structure.

Second question, is it possible to prevent the start of a drag operation when responding to XTP_NM_GRIDDRAGDROP ? I have tried setting different values on *pResult and pItemNotify->bReturnValue.

Third question: I tried to use XTP_NM_GRID_HASVALIDDROPTYPE message to change dropEffect, however, this is ignored in DROPEFFECT CXTPGridControl::OnDragOver? 

XTP_NM_GRIDDRAGDROP nmData;
nmData.dropEffect  = dropEffect;
nmData.pDataObject = pDataObject;
nmData.pt    = point;
// R-DD <<
nmData.dwKeyState = dwKeyState;
// R-DD >>

int iValid = (int)SendNotifyMessage(XTP_NM_GRID_HASVALIDDROPTYPE, (NMHDR*)&nmData);

m_nOLEDropAbove = nmData.bAbove;

if ((dropEffect != DROPEFFECT_NONE) // <- Shouldn't this be nmData.dropEffect?
&& (!pDataObject || (!pDataObject->IsDataAvailable(m_cfGrid) && iValid != 1)))
dropEffect = DROPEFFECT_NONE;


Regards, 
Fredrik
Windows 11, Visual Studio 2026, Toolkit Pro 24.3.0
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.

This page was generated in 0.391 seconds.