Report Control: Drag a single item
Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Suite Pro
Forum Description: Topics Related to Codejock Suite Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=1652
Printed Date: 28 November 2024 at 2:16am Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com
Topic: Report Control: Drag a single item
Posted By: gshawn
Subject: Report Control: Drag a single item
Date Posted: 11 January 2005 at 3:39am
Hi,
I am trying to replicate the Outlook 2003 drag & drop functionality with the Report control. Namely, dragging the selected item to another object on my form.
I can do a ReportControl.Drag but that starts a drag for the entire report control. Is there any way around to start a drag for the current item only?
I am using ActiveX 9.51. Thank you very much.
|
Replies:
Posted By: SuperMario
Date Posted: 11 January 2005 at 6:55am
Drag & Drop is not currently supported
|
Posted By: Boyd
Date Posted: 11 January 2005 at 7:19am
Can you please add this to the TODO list? This is some core functionality that most people would assume the control could support. I just now started trying to replace my old grid control with ReportControl, and it's been a disappointing experience.
|
Posted By: SuperMario
Date Posted: 11 January 2005 at 7:20am
It has been added, but most likely will not be in the next release.
|
Posted By: Boyd
Date Posted: 11 January 2005 at 7:23am
Great... thank you!
|
Posted By: gshawn
Date Posted: 11 January 2005 at 2:32pm
Yes, this is a little disappointing. I have built most 90% of my application around the CodeJock controls after I purchased them, but now I will have to wait until this is added to the controls (which may not even be in this next release) to release the application. I had (unfortunately) assumed that the control supported the essential functionality of drag and drop... I would appreciate it if this could make it in as soon as possible, but I understand you guys are doing your best. I just hope I won't have to hold for too long. Do you have perhaps an estimated time frame, so I can figure out if I need to switch to a different control?
Thanks for your prompt support.
|
Posted By: gshawn
Date Posted: 22 March 2005 at 2:43am
Hi,
I logged this issue back in January as #3541. However, when the issue was closed in IssueTrack (moved to Feature Request list) I lost the ability to get any updates on it. Can someone please tell me if the drag and drop functionality is planned for v10, or if it has been pushed back to a later release? Thanks in advance.
|
Posted By: Oleg
Date Posted: 22 March 2005 at 6:02am
We plan to add it.
What features you need to be added with drag'n'drop.
Move inside control? Copy iside control? Copy outside control?
Or just reorder rows then no sorting enabled?
------------- Oleg, Support Team CODEJOCK SOFTWARE SOLUTIONS
|
Posted By: Boyd
Date Posted: 22 March 2005 at 7:31am
I think full drag/drop support for move/copy inside/outside the control (in all combinations) would be the best base. We'd need the flexibility to be able to drag a single record, and entire row, or an entire column. Reordering rows would be a nice feature as well with the obvious caveat that sorting would be disabled. Of course, we'd also need to be able to control the data that was used for the drag/drop operation.
|
Posted By: gshawn
Date Posted: 24 March 2005 at 6:04pm
Personally (I can't speak for everyone) I think we at least need to be able to replicate the drag and drop functionality of the Office 2003 message pane. That would include most of the items Boyd mentioned (not sure about dragging a column), plus being able to drag a group, etc. I also think the ability to drag/drop to/from Windows Explorer is crucial.
The only drag and drop implementation I am really familiar with is the OLE drag and drop support for regular VB components such as textbox, listview... OLEStartDrag, OLEDragOver, OLECompleteDrag , OLEDragDrop, Listview.DropHighlight, etc. VB's OLE drag & drop has been good to me.
In the end, whatever you guys decide to do, I will be happy... well, to a certain extent :) But I'd rather have simple d&d support than no d&d support at all.
Edit: Thanks for being responsive and asking for our feedback. I for one appreciate this kind of thing immensely.
|
Posted By: SuperMario
Date Posted: 22 March 2006 at 2:47pm
Will be available in version 10 coming soon Beta 2 is available now with Drag and Drop. beta.codejock.com to download.
|
Posted By: gshawn
Date Posted: 22 March 2006 at 3:09pm
SuperMario wrote:
Will be available in version 10 coming soon Beta 2 is available now with Drag and Drop. beta.codejock.com to download. |
You, sir, are a gentleman and a scholar.
Would it be possible to get some documentation on this feature for the next Beta? I would love to test it in detail and share my feedback with you, but I'm not exactly sure how to evaluate this implementation without any docs. Thanks for at least including a sample.
Cheers!
|
Posted By: SuperMario
Date Posted: 22 March 2006 at 3:53pm
Putting documentation together as I speak. Until then, there is a sample of how to use it In report sample, Report Control->Test->Drag and Drop Test.
There will also be a few events added, I noticed the need while working with it.
BTW, Drag and Drop "just" made it into Beta 2, thus, no documentation.
|
Posted By: SuperMario
Date Posted: 23 March 2006 at 8:31am
Just an update, BeginDrag and DropRecords events have been added to the Report Control.
|
Posted By: SuperMario
Date Posted: 23 March 2006 at 9:32am
Here is some documentation on the Drag and Drop sample, it should answer your questions. Remember, the sample here includess 2 events not available in Beta 2
Option Explicit
'An integer value that will be used to indicate whether an item in the DataObject object matches the 'specified ClipboardString(Parameter in EnableDrageDrop) format. The DataObject is a parameter in OLEDrag events for controls 'that contains the data on the clipboard. Dim cfRecords As Integer
Private Sub Form_Load() 'Adds 3 items to the List Control lstItems.AddItem "Item 1" lstItems.AddItem "Item 2" lstItems.AddItem "Item 3" 'Do not allow columns to be removed from the Report Control wndReport.AllowColumnRemove = False 'Add a column named "Items" to the Report Control wndReport.Columns.Add 0, "Items", 50, True Dim str As String, i As Long 'Add 4 records\rows to the Report Control For i = 4 To 8 Dim Record As ReportRecord Dim Item As ReportRecordItem Set Record = wndReport.Records.Add str = "Item " & CStr(i) Set Item = Record.AddItem(str) Next i 'Adds the records the Report Control wndReport.Populate 'To enable Drag and Drop in a Report Control the EnableDragDrop method must be used. EnableDragDrop 'does two things, first it sets a clipboard string that will be used to indicate the type of data 'that is copied to the clipboard. Second, it sets the drag and drop effects that are allowed when 'dragging items to\from the report control. The available effects are stored in the XTPReportDragDrop 'enumeration. If dragging items to\from one or more Report Control's, the same clipboard string must 'be used for all Report Control's when calling EnableDragDrop. ' 'Below, the clipboard string is "ReportSample:frmDragDrop" and we are allowing all drag and drop operations cfRecords = wndReport.EnableDragDrop("ReportSample:frmDragDrop", xtpReportAllowDrag Or xtpReportAllowDrop) End Sub
Sub ClearListSelection() Dim i As Long For i = 0 To lstItems.ListCount - 1 lstItems.Selected(i) = False Next End Sub
'The Mouse_Mouve event will be used to prepare records to be dropped into the report. Private Sub lstItems_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
'If the left mouse button is pressed while in the List Control If (Button And vbLeftButton) Then Dim Records As ReportRecords 'CreateRecords is primarily used to create an empty ReportRecords collection in Drag and Drop 'operations. The new ReportRecords collection is used to create a collection of ReportRecord 'objects to be dropped into the Report Control or to retrieve records that have been dragged 'out of the Report Control. ' 'Below, a records collection is created that will contain a record for each item that 'is currently selected in the list control Set Records = wndReport.CreateRecords Dim i As Long 'Loop through all items in the List Control For i = 0 To lstItems.ListCount - 1 'If the list item is selected, then add it to then create a record for it 'in the records colleciton If lstItems.Selected(i) Then Dim Record As ReportRecord 'Add a new record to the records collection Set Record = Records.Add Record.AddItem lstItems.List(i) Debug.Print "Added " & i End If Next 'The DragRecords method is used to prepare records to be dropped into the Report Control. 'DragRecords accepts a ReportRecords collection created by CreateRecords. Any records that 'have been prepared using DragRecords will be added to the Report when the items are dropped 'into the Report Control. Typically DragRecords would be used in the MouseMove event of the 'control from which items are being dragged. The Report Control will automatically add the 'new records to the report once they have been dropped. ' 'Below, the Records collection is filled with a record that corresponds to each item that is 'currently selected in the List Control. If the items are dropped into the Report Control, then 'all records contained in the Records collection will be added to the report. ' 'Now Data.GetFormat(cfRecords) will return True as some Records have been added to the clipboard wndReport.DragRecords Records End If End Sub
'The OLEDragDrop event will be used to add items to the List Control that have been dragged from the Report Control Private Sub lstItems_OLEDragDrop(Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, X As Single, Y As Single)
'If the format of the data on the clipboard is of type "ReportSample:frmDragDrop" as set with EnableDragDrop If Data.GetFormat(cfRecords) Then 'Create a ByteArray Dim byteData() As Byte 'Retrieve the Records collection from the clipboard, the data is stored as a ByteArray byteData = Data.GetData(cfRecords) Dim Records As ReportRecords 'The CreateRecordsFromDropArray method is used when retrieving records that have been dragged 'from the Report Control. CreateRecordsFromDropArray accepts the ByteArray returned from the 'Data.GetData parameter from any control's OLEDragDrop event and populates a ReportRecords 'collection created by CreateRecords. ' 'Below, the Records collection is populated by the records that were copied to the clipboard Set Records = wndReport.CreateRecordsFromDropArray(byteData) 'If there were some records on the clipboard If (Not Records Is Nothing) Then 'Unselect all items in the list control ClearListSelection Dim i As Long 'Add a list item for each record that was on the clipboard For i = 0 To Records.Count - 1 lstItems.AddItem Records(i).Item(0).Value lstItems.Selected(lstItems.ListCount - 1) = True Next End If 'If the ctrl key was pressed when the items were dropped, then the drag operation was a Copy 'Else, a Move operation is performed If ((Shift And 2) = 0) Then Effect = vbDropEffectMove Else Effect = vbDropEffectCopy End If End If End Sub
'The OLEDragOver event is used to detect when items are dragged over the list control Private Sub lstItems_OLEDragOver(Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, X As Single, Y As Single, State As Integer) Effect = 0 'If the format of the data on the clipboard is of type "ReportSample:frmDragDrop" as set with EnableDragDrop If Data.GetFormat(cfRecords) Then 'If the ctrl key is pressed when items are dragged over the list control, then the drag operation is Copy 'Else, a Move operation is performed If ((Shift And 2) = 0) Then Effect = vbDropEffectMove Else Effect = vbDropEffectCopy End If End If End Sub
'The BeginDrag event occurs when records are being dragged from the Report Control, and provides a 'ReportRecords collection containing all of the selected records when the drag operation started. Private Sub wndReport_BeginDrag(ByVal Records As XtremeReportControl.IReportRecords) Debug.Print "Begin Drag. Records.Count = " & Records.Count End Sub
'The DropRecords event occurs when records are dropped into a Report Control, and provides a 'ReportRecords collection containing all of the records that will be dropped into the Report Control. 'This gives the opportunity to modify the ReportRecords collection before they are actually added 'to the Report Control. Private Sub wndReport_DropRecords(ByVal Records As XtremeReportControl.IReportRecords) Debug.Print "Drop Records. Records.Count = " & Records.Count End Sub
|
|
Posted By: gshawn
Date Posted: 23 March 2006 at 5:31pm
Thanks, this will be a great help!
|
Posted By: gbdc
Date Posted: 11 June 2006 at 1:58am
Hi.
When will OLEDragDrop and OLEDragOver events become available?
Thanks!
|
|