Android Question DraggableView class Get views position on screen

apty

Active Member
Licensed User
Longtime User
I am using draggable view class to move some buttons on screen. How can i get the view's (button's) position on screen (the left and top position) on my device.
 

apty

Active Member
Licensed User
Longtime User
thanks Erel,
in my case, i would like to know the position of the button that has been dragged, just like in b4a visual designer. If i have 3 buttons, i drag the first one and drop it at let say position X( X representing the top position). i then drag button 2 to another position X2. I then have a textbox that traces the position of the button being dragged, the textbox changes its value according to the current button i am dragging. Now my problem is, how do i get the position of the current button i have just clicked on an dragged? noting that all buttons are draggable
 
Upvote 0

apty

Active Member
Licensed User
Longtime User
Now another headache is caching the click event of the button. I have added onclicklistener to the panel in draggableview class but i am not able to catch it as shown below:

on Initialize of draggableview
B4X:
r.SetOnClickListener("Panel1_Click")

Then
B4X:
Sub Panel1_Click

    CallSubDelayed(Main,"checkclick")
End Sub

Then on main

B4X:
Sub checkclick
    Msgbox(btn.Tag,"Tag")
End Sub
 
Upvote 0
Top