Im using the draggableview class to drag my labels around the screen and it works great, however i am at a complete and utter lost when it comes to docking those labels to a certain point.
Here is the code i have:
I have 5 labels but only need to dock 3. Anyone have any ideas, i really need help. :sign0085::sign0085::sign0085::sign0085:
Here is the code i have:
B4X:
'Class module
Sub Class_Globals
Private innerview As View
Private lblletter As Label
Private lblletter2 As Label
Private lblletter3 As Label
Private lblrandom As Label
Private lblrandom2 As Label
Private lblrandom3 As Label
Private lblrandom4 As Label
Private lblrandom5 As Label
Private downx, downy As Int
Private ACTION_DOWN, ACTION_MOVE, ACTION_UP As Int
End Sub
Public Sub Initialize(Activity As Activity, v As View)
innerview = v
lblrandom.Initialize("")
'pnl1.Color = Colors.Transparent
Activity.AddView(lblrandom, v.Left, v.Top, v.Width, v.Height)
ACTION_DOWN = Activity.ACTION_DOWN
ACTION_MOVE = Activity.ACTION_MOVE
ACTION_UP = Activity.ACTION_UP
Dim r As Reflector
r.Target = lblrandom
r.SetOnTouchListener("lblrandom_Touch")
innerview = v
lblrandom2.Initialize("")
Activity.AddView(lblrandom2, v.Left, v.Top, v.Width, v.Height)
ACTION_DOWN = Activity.ACTION_DOWN
ACTION_MOVE = Activity.ACTION_MOVE
ACTION_UP = Activity.ACTION_UP
Dim r As Reflector
r.Target = lblrandom2
r.SetOnTouchListener("lblrandom2_Touch")
innerview = v
lblrandom3.Initialize("")
Activity.AddView(lblrandom3, v.Left, v.Top, v.Width, v.Height)
ACTION_DOWN = Activity.ACTION_DOWN
ACTION_MOVE = Activity.ACTION_MOVE
ACTION_UP = Activity.ACTION_UP
Dim r As Reflector
r.Target = lblrandom3
r.SetOnTouchListener("lblrandom3_Touch")
innerview = v
lblrandom4.Initialize("")
Activity.AddView(lblrandom4, v.Left, v.Top, v.Width, v.Height)
ACTION_DOWN = Activity.ACTION_DOWN
ACTION_MOVE = Activity.ACTION_MOVE
ACTION_UP = Activity.ACTION_UP
Dim r As Reflector
r.Target = lblrandom4
r.SetOnTouchListener("lblrandom4_Touch")
innerview = v
lblrandom5.Initialize("")
Activity.AddView(lblrandom5, v.Left, v.Top, v.Width, v.Height)
ACTION_DOWN = Activity.ACTION_DOWN
ACTION_MOVE = Activity.ACTION_MOVE
ACTION_UP = Activity.ACTION_UP
Dim r As Reflector
r.Target = lblrandom5
r.SetOnTouchListener("lblrandom5_Touch")
End Sub
Private Sub lblrandom_Touch (o As Object, ACTION As Int, x As Float, y As Float, motion As Object) As Boolean
If ACTION = ACTION_DOWN Then
downx = x
downy = y
lblrandom.addstickyedge(2, 40%x)
Else
Log("not down")
innerview.Left = innerview.Left + x - downx
innerview.Top = innerview.Top + y - downy
lblrandom.Left = innerview.Left
lblrandom.Top = innerview.Top
End If
Return True
End Sub
Private Sub lblrandom2_Touch (o As Object, ACTION As Int, x As Float, y As Float, motion As Object) As Boolean
If ACTION = ACTION_DOWN Then
downx = x
downy = y
Log("2 down")
Else
innerview.Left = innerview.Left + x - downx
innerview.Top = innerview.Top + y - downy
lblrandom2.Left = innerview.Left
lblrandom2.Top = innerview.Top
End If
Return True
End Sub
Private Sub lblrandom3_Touch (o As Object, ACTION As Int, x As Float, y As Float, motion As Object) As Boolean
If ACTION = ACTION_DOWN Then
downx = x
downy = y
Log("3 down")
Else
innerview.Left = innerview.Left + x - downx
innerview.Top = innerview.Top + y - downy
lblrandom3.Left = innerview.Left
lblrandom3.Top = innerview.Top
End If
Return True
End Sub
Private Sub lblrandom4_Touch (o As Object, ACTION As Int, x As Float, y As Float, motion As Object) As Boolean
If ACTION = ACTION_DOWN Then
downx = x
downy = y
Log("4 down")
Else
innerview.Left = innerview.Left + x - downx
innerview.Top = innerview.Top + y - downy
lblrandom4.Left = innerview.Left
lblrandom4.Top = innerview.Top
End If
Return True
End Sub
Private Sub lblrandom5_Touch (o As Object, ACTION As Int, x As Float, y As Float, motion As Object) As Boolean
If ACTION = ACTION_DOWN Then
downx = x
downy = y
Log(motion)
Log("5 down")
Else
innerview.Left = innerview.Left + x - downx
innerview.Top = innerview.Top + y - downy
lblrandom5.Left = innerview.Left
lblrandom5.Top = innerview.Top
End If
Return True
End Sub
I have 5 labels but only need to dock 3. Anyone have any ideas, i really need help. :sign0085::sign0085::sign0085::sign0085: