AddView dynamic touch

SpaceCow

Member
Licensed User
Longtime User
Hi,

Is is possible when i dynamically add a Scrollview with AddView to connect a Touch function with it?

Currently i have this in the Activity_Create:
B4X:
Dim scvMain As ScrollView
Dim Panel1 As Panel

scvMain.Initialize(500)
Panel1.AddView(scvMain,0,0,100%x,100%y)

Now i want to check if the scvMain is touched but this doesn't work:
B4X:
Sub scvMain_Touch (Action As Int, X As Float, Y As Float)
   Msgbox("Test", "test")
End Sub

Can someone help me please? Thanks!
 

stefanobusetto

Active Member
Licensed User
Longtime User
i've looked in the manual (page 174)
there are no events for the scrollview
but you can add a panel inside the scrollview
something like this

B4X:
Dim p As Panel
p.initialize("zzz")
scvMain.AddView(p, 10,10,1000,1000)
End Sub

Sub zzz_touch (Action As Int, X As Float, Y As Float)
Msgbox ( "zzz" , "ZZZ" )
End Sub
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
What exactly do you want to do with the Touch event ?
You must be aware that the touch event is cosumed by the ScrollView for vertical or horizontal scrolling.
If you want horizontal and vertical scrolling for a ScrollView you should have a look at the ScrollView2 library.

Beat regards.
 
Upvote 0
Top