Moving Container Controls

I have DesktopContainerControls that I would like to be able to move around in a window, tab or page panel, or another DesktopContainerControl.

My goal is to move it from its current place and put it where I dropped it. Is this possible and if so, how?


i use this

Function MouseDown(x As Integer, y As Integer) Handles MouseDown as Boolean
  MouseDownMemory = New Pair(X,Y)
  Return True
End Function
Sub MouseDrag(x As Integer, y As Integer) Handles MouseDrag
  CardDrag = Me
  Var drag As New DragItem(Self, 0, 0, Me.Width, Me.Height)
  Var pic As New Picture(Me.Width,Me.Height)
  drag.DragPicture = pic
  drag.MouseCursor = System.Cursors.FingerPointer
  drag.Text = "Card"
  If Abs(MouseDownMemory.Left -X)>16 Or Abs(MouseDownMemory.Right -Y)>16 Then
  End If
End Sub

in a modul
Public Property CardDrag As Card

drop in a column

Sub DropObject(obj As DragItem, action As DragItem.Types) Handles DropObject
  If obj.TextAvailable Then
    If obj.Text = "Card" Then
      Var NewCard As Card = CardDrag.Clone
      NewCard.Top = obj.DropTop
      NewCard.Width = Self.Width
      NewCard.CardDate = DateTime.Now.ToString
      Add(NewCard, True)
      CardDrag = Nil
      RaiseEvent Changed
    End If
  End If
End Sub
1 Like

Thanks, Marcus! This looks good. I’ll give it a try.