Print Page | Close Window

Set Effect value in TreeView's OLEDragDrop

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Controls
Forum Description: Topics Related to Codejock Controls
URL: http://forum.codejock.com/forum_posts.asp?TID=18533
Printed Date: 30 November 2024 at 11:37am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Set Effect value in TreeView's OLEDragDrop
Posted By: mjohn
Subject: Set Effect value in TreeView's OLEDragDrop
Date Posted: 10 June 2011 at 12:44pm
Hi.

In TreeView's  TreeView's OLEDragDrop event
whether  set  Effect = vbDropEffectMove  or Effect = vbDropEffectMove,  

in the Source's OLECompleteDrag event
Effect will get the same value,  the set value to Effect in TreeView's OLEDragDrop event is invalid.

Thanks!

V15.0.1
VB6 SP6
Win7







Replies:
Posted By: Albert1
Date Posted: 23 June 2011 at 10:59am
I use code like this one. It's working ok for me.
Private Sub Form_Load()
    tvwExplorer.OLEDragMode = xtpOLEDragAutomatic
    tvwExplorer.OLEDropMode = xtpOLEDropManual
End Sub
Private Sub tvwExplorer_OLEStartDrag(Data As XtremeSuiteControls.DataObject, AllowedEffects As Long)
Dim oDragNode As TreeViewNode
    If Not Me.tvwExplorer.SelectedItem Is Nothing Then
 ' check if valid ...
        AllowedEffects = vbDropEffectMove
    Else
        AllowedEffects = vbDropEffectNone
    End If
End Sub

Private Sub tvwExplorer_OLEDragOver(ByVal Data As XtremeSuiteControls.DataObject, Effect As Long, ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Single, ByVal Y As Single, ByVal state As Integer)
    ' do what u need
    If Not okDrop Or state = vbLeave Then
        Set tvwExplorer.DropHighlight = Nothing
        Effect = vbDropEffectNone
    Else
        Set tvwExplorer.DropHighlight = tvwExplorer.HitTest(x, Y)
    End If
End Sub
 
Private Sub tvwExplorer_OLEDragDrop(ByVal Data As XtremeSuiteControls.DataObject, Effect As Long, ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Single, ByVal Y As Single)
    ' do what u need
    ' nothing about Effect
End Sub
 
Private Sub tvwExplorer_OLECompleteDrag(Effect As Long)
    Effect = vbDropEffectNone
End Sub


-------------
Product: Xtreme SuitePro (ActiveX) version 13.4.1 / 16.3.0

Platform: Windows Vista (32bit) - SP 2

Language: Visual Basic 6.0 (SP6)



Posted By: mjohn
Date Posted: 27 June 2011 at 3:51am
I modify your code as below:
-------------------------------------------------------------------------------------------------------
Option Explicit

Private Sub Form_Load()
    tvwExplorer.OLEDragMode = xtpOLEDragAutomatic
    tvwExplorer.OLEDropMode = xtpOLEDropManual
    
    tvwExplorer.Nodes.Add , , "node1", "node1"
    tvwExplorer.Nodes.Add , , "node2", "node2"
    tvwExplorer.Nodes.Add , , "node3", "node3"
    tvwExplorer.Nodes.Add , , "node4", "node4"
End Sub

Private Sub tvwExplorer_OLEStartDrag(Data As XtremeSuiteControls.DataObject, AllowedEffects As Long)
Dim oDragNode As TreeViewNode

    If Not Me.tvwExplorer.SelectedItem Is Nothing Then
 ' check if valid ...
        AllowedEffects = vbDropEffectMove
    Else
        AllowedEffects = vbDropEffectNone
    End If

End Sub

Private Sub tvwExplorer_OLEDragDrop(ByVal Data As XtremeSuiteControls.DataObject, Effect As Long, ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Single, ByVal Y As Single)
    ' do what u need
    ' nothing about Effect
    If MsgBox("Select yes to set Effect = vbDropEffectMove, Select no to set Effect = vbDropEffectCopy ", vbYesNo, "Yes") = vbYes Then
        Effect = vbDropEffectMove
    Else
        Effect = vbDropEffectCopy
    End If
End Sub

Private Sub tvwExplorer_OLECompleteDrag(Effect As Long)
    MsgBox "result:" & IIf(Effect = vbDropEffectMove, "vbDropEffectMove", "vbDropEffectCopy"), vbOKOnly
End Sub

--------------------------------------------------------------------------------------------------------

 Above code,  in tvwExplorer_OLEDragDrop event, whether set  Effect = vbDropEffectMove or set Effect = vbDropEffectCopy
in tvwExplorer_OLECompleteDrag event,  Effect  always is vbDropEffectMove , 
this is not right,  it should be the same as the value in tvwExplorer_OLEDragDrop .

Thanks!




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