Moving Panel with touch event Question

ALG460

New Member
Licensed User
Longtime User
Hi All

New here. I'm not really a programmer but I self taught myself VB and used to do fairly well with it. I'm loving Basic4android.

I'm trying to move a panel using the touch event. It works fine for the most part but while dragging the panel it jitters and jumps all over the screen but ultimately ends up precisely where my finger lifts up. My code seems too simple so I must need something more. Here's the code. Thanks. Tony

Sub pnlGraph_Touch (Action As Int, X As Float, Y As Float)

Select Action
Case 0 'DOWN
Xtouch = X
Ytouch = Y

Case 2 'MOVE
pnlGraph.Left = pnlGraph.Left + X - Xtouch
pnlGraph.Top = pnlGraph.Top + Y - Ytouch

End Select


End Sub
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Upvote 0

shaxboz

Member
Licensed User
Longtime User

Very good example. but I have problem with it.
I added 5 imageview to this panel. If I do`nt use Imagweview_Click event, everything is normal working. If I use Click event for Imageviews, this panel is not moving. What should I do? I need moving panel and 5 clickable imageviews in this panel.
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
Do the image views cover the whole panel? If so, their click events will be consuming the touch for the panel. You will need to leave an empty space on the panel, perhaps with a label and a move Icon to make it obvious to the user where they need to touch to move it.

If not, can you post a small test project showing the problem. So we don't have to build one.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…