Print Page | Close Window

OLE Drag Drop

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=18828
Printed Date: 05 October 2024 at 4:30am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: OLE Drag Drop
Posted By: DocItDev
Subject: OLE Drag Drop
Date Posted: 15 August 2011 at 3:46pm
We're currently in the process of migrating our VB6 code over to .Net, and we've run into a large difference between how the OLEDragDrop even was defined in VB6 and how it's defined in .Net.

Essentially the old VB6 event looks like this:

Private Sub ReportControl1_OLEDragDrop(ByVal Data As XtremeReportControl.DataObject, Effect As Long, ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Single, ByVal Y As Single)

while the .Net event looks like this:

Private Sub RC1_OLEDragDrop(ByVal sender As Object, ByVal e As AxXtremeReportControl._DReportControlEvents_OLEDragDropEvent) Handles RC1.OLEDragDrop

while your documentation says it should look like this:

Public Event OLEDragDrop(ByVal Data As DataObject, ByRef Effect As Long, ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Long, ByVal y As Long)

Realistically, it doesn't matter how it actually looks, since most .Net DragDrop events look similar to how your OLEDragDrop event looks, what it really comes down to is the fact that your event doesn't seem to have any way to get at the DataObject associated with a DragDrop event that contains the information on what was dropped.

Please assist.



Replies:
Posted By: DocItDev
Date Posted: 30 August 2011 at 9:25am
It's been two weeks, is there any information on this issue?


Posted By: Orf
Date Posted: 29 September 2011 at 5:22pm
Hey DocItDev,

I've been in the process of upgrading an internal project from VS2008 to VS2010 and ran into a similar 'interface-y' thing so I think I have the answer for you.

1. Instead of worrying about your project for a minute, create a new C# test application and go to the form designer. 
2. In the designer's toolbox, right click and select Add Tab.  Call it "CodeJock Controls".
3. Expand the tab and it should say there are no usable controls in the group (because we haven't added them yet.) 
4. Right click in the tab and select "Choose controls", then go to COM Components and check every "Xtreme" checkbox so you get all the codejock stuff.

Now you should be setup for C# Codejock work and here's where we'll start the DragDrop sample.

5. Drag the Xtreme Report Control onto the form, set the following parameters:
Dock=Fill   (just to make the sample nice)
OLEDropMode=xtpOLEDropManual      (needed for drag/drop)

6. In the events, double click in the value field of "OLEDragDrop" to automatically create the callback function for you.

Here you should see that it has added one like this:
private void axReportControl1_OLEDragDrop(object sender, AxXtremeReportControl._DReportControlEvents_OLEDragDropEvent e)

Notice it's NOT the same as what you noted in your post.  This is because .NET has written out the Ax*** interop wrapper class for the com control. 

What you're using is the XtremeReportControl.ReportControl and not the AxXtremeReportControl.ReportControl which returns a DragDrop interface of void OLEDragDropCallback(XtremeReportControl.DataObject Data, ref int Effect, short Button, short Shift, int x, int y).

The Ax*** stuff makes the controls inherit from a Windows.Forms.Control object which is pretty key to using the com controls in C#.

After all of that you should be able to read the list of files you dropped onto the control from explorer like this:

        private void axReportControl1_OLEDragDrop(object sender, AxXtremeReportControl._DReportControlEvents_OLEDragDropEvent e)
        {
            for(int x = 1; x < e.data.Files.Count + 1; x++) // OLE stuff is indexed off 1 and not 0.  :(
            {
                Debug.WriteLine("File: " + e.data.Files[x]);
            }
        }


Does that help at all?


Posted By: DocItDev
Date Posted: 11 October 2011 at 2:41pm
Thanks for the post Orf, but it doesn't really help.

The base Codejock event gives access to a collection of files dropped on to the control.  Unfortunately for my needs I need both the possibility of a collection of files, and the possibility of a string (to cover both drag from the operating system, and to cover a drag from a non-Codejock control that is still inside of my application.)



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