Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Controls
  New Posts New Posts RSS Feed - Set Effect value in TreeView's OLEDragDrop
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Set Effect value in TreeView's OLEDragDrop

 Post Reply Post Reply
Author
Message
mjohn View Drop Down
Groupie
Groupie


Joined: 24 January 2011
Status: Offline
Points: 24
Post Options Post Options   Thanks (0) Thanks(0)   Quote mjohn Quote  Post ReplyReply Direct Link To This Post Topic: Set Effect value in TreeView's OLEDragDrop
    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




Back to Top
Albert1 View Drop Down
Groupie
Groupie
Avatar

Joined: 01 February 2007
Location: Italy
Status: Offline
Points: 66
Post Options Post Options   Thanks (0) Thanks(0)   Quote Albert1 Quote  Post ReplyReply Direct Link To This Post 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)

Back to Top
mjohn View Drop Down
Groupie
Groupie


Joined: 24 January 2011
Status: Offline
Points: 24
Post Options Post Options   Thanks (0) Thanks(0)   Quote mjohn Quote  Post ReplyReply Direct Link To This Post 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!

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.172 seconds.