Linking items in tree views

  • 10 years ago

    I am trying to develop an application that allows users to map one data source to another.  My intention was to diplay the 2 data schemas in tree views and the allow users to drap an item from the first tree and drop on an item on the second to create a link (similar to how you would do destination and source mapping in the likes of SQL server).

    Have looked at a few different drag and drop articles but I struggling to work out best way of doing this.

    Any help would be much appreciated Smiley Face [:)]

    Thanks.

     

     

  • 10 years ago

    I am also confused by dagdops but I made it quite finely like this

    1st ctrl:  ondragbegin { if selected [remember selected, continue] }
    2nd ctrl: ondropenter {if remembered something [modify data, modify ctrl1, modify ctrl2]}

    also good way is to let dropped data to be "in drag" still ... so you can ping pong data and see them being ponged between controls, and them write only after end mouse down...

    um> i am not sure here is my /bit older but only one to this/ example

      Private Sub ListView1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles ListView1.MouseMove
        If Not Me.ComboBox1.SelectedIndex = Me.ComboBox2.SelectedIndex Then
          If ListView1.SelectedItems.Count > 0 And e.Button = MouseButtons.Left Then
            ListView1.DoDragDrop("", DragDropEffects.None)
          End If
        End If
      End Sub






      Private Sub ListView2_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles ListView1.MouseMove
        If Not Me.ComboBox1.SelectedIndex = Me.ComboBox2.SelectedIndex Then
          If ListView2.SelectedItems.Count > 0 And e.Button = MouseButtons.Left Then
            ListView2.DoDragDrop("", DragDropEffects.None)
          End If
        End If
      End Sub







      Private Sub ListView1_DragLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListView1.DragLeave
        LeaveDrag(ListView2, ListView1, cb1id())
      End Sub



      Private Sub ListView2_DragLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListView2.DragLeave
        LeaveDrag(ListView1, ListView2, cb2id())
      End Sub


Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Measuring programming progress by lines of code is like measuring aircraft building progress by weight.” - Bill Gates