Forum
Please
Log In
to post a new message or reply to an existing one. If you are not registered, please
register.
NOTE: Some forums may be read-only if you are not currently subscribed to
our technical support services.
Subject |
Author |
Date |
|
Offer Har
|
Jan 10, 2010 - 10:20 PM
|
Dear Support, I have an application with CExtGridWnd and CExtTreeGridWnd . I need to drag a row from the grid and drop it into the tree’s first level with will add a child node to that node. Can you please explain how this can be done? I could not find an exact sample, and it’s not completly clear why I need to do in OnGbwDataDndDo exactly, and in which of my classes - the tree or the grid. Thanks, Ron.
|
|
Technical Support
|
Jan 11, 2010 - 5:41 AM
|
The CExtGridWnd -based control should initialize drag-n-drop. We recommend you to use the standard OLE drag-n-drop for that. The CExtGridBaseWnd::OnGbwDataDndDo() virtual method is invoked when the grid detects the drag-n-drop starting event for the inner data cells. The CExtTreeGridWnd -based control should implement the OLE drop target. Please note, the OLE drag-n-drop feature is part of OLE - not a part of COM. This means your application should invoke the ::AfxOleInit() or ::OleInitialize() API s at startup – not ::CoInitialize() . Unfortunately we don’t have a ready to use sample similar to what you need. But the FormEditor sample application implements several OLE drag sources and drop targets. You can start dragging the toolbox item implementing control, the drag it over MDI tabs and drop it into some of opened view windows. The MDI tabs become selected when you drag objects over them. The form editor view window understands the drop event. The toolbox control initializes the drag-n-drop. Both MDI tabs and OLE view are implementing the OLE drop target feature. Please take a look at the CFormEditorToolBoxWnd::OnToolBoxWndStartItemDrag() method. This is how to start the standard OLE drag-n-drop. The CFormEditorMdiTabWnd::CMdiTabOleDropTarget::OnDragOver() and CFormEditorView::OnDragOver() methods are invoked when data object is dragged over a window implementing OLE drop target. The CFormEditorView::OnDrop() method is invoked when you dropped some control object into form editor view window. The OLE drag-n-dropping feature is close to the Windows clipboard related APIs. Both drag-n-dropped data and clipboard data are based on the same clipboard format descriptors which define some general type of data. Both clipboard and dragged data are typically based on something serialized into memory file/archive.
|
|