Print Page | Close Window

DropRecordsEx TargetRecord is wrong in 13.1.0

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=15579
Printed Date: 08 May 2024 at 3:53pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: DropRecordsEx TargetRecord is wrong in 13.1.0
Posted By: John31
Subject: DropRecordsEx TargetRecord is wrong in 13.1.0
Date Posted: 10 November 2009 at 3:10pm

In 13.1 the DropRecordsEx event now returns the incorrect TargetRecord when fired.

If the Target Record is a child record the parent record is reported as the target. 

Edit the ReportSample.vbp file in ...\Xtreme SuitePro ActiveX v12.1.1\Samples\ReportControl\VB\ReportSample folder

and

Edit the ReportSample.vbp file in ...\Xtreme SuitePro ActiveX v13.1.0\Samples\ReportControl\VB\ReportSample folder


Replace the Form_Load() event with the following code on the frmDragDrop.frm


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
    Dim oCol As ReportColumn
    Set oCol = wndReport.Columns.Add(0, "Items", 50, True)
    ' set column as tree
    oCol.TreeColumn = True
    wndReport.PaintManager.TreeIndent = 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)
       
        ' add child records
        Dim oRec As ReportRecord
        Dim j As Integer
        For j = 1 To 10
            Set oRec = Record.Childs.Add()
            Set Item = oRec.AddItem(str & "-" & CStr(j))
        Next j
        Record.Expanded = True
       
    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


Now add the wndReport_DropRecordsEx Event as shown below

Private Sub wndReport_DropRecordsEx(ByVal TargetRecord As XtremeReportControl.IReportRecord, ByVal Records As XtremeReportControl.IReportRecords, ByVal Above As Boolean)
  Debug.Print "wndReport_DropRecordsEx TargetRecord.Item(0).Value=" & TargetRecord.Item(0).Value & ", Above=" & Above
End Sub


1) Run the programs
2) Click Additional Samples from the menu
3) Select Drag and Drop Test
4) Drag a child item and drop on another child item

In the 12.1.1 version the child item is reported as the target.

In the 13.1.0 version the parent of the child item is reported as a target item.

 



-------------
Regards

John Layton



Replies:
Posted By: mdoubson
Date Posted: 12 November 2009 at 7:56pm
Use https://forum.codejock.com/uploads/BetaOCX/ReportControlBeta13-2.rar - https://forum.codejock.com/uploads/BetaOCX/ReportControlBeta13-2.rar  
and apply settings ReportControl.UnrestrictedDragDrop = True


-------------
Mark Doubson, Ph.D.



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