Touchevent and ScrolView

TommyE28

Member
Licensed User
Longtime User
Hi,

in my program i will use the touchevent to move a panel inside a scrolview. But it does not work as I thought. A touchevent is triggered only in a narrow range.
A test with a panel without Scrolview working properly, the event is triggered on the entire screen.

Sub Globals
Dim pan As Panel
Dim but As Button
Dim scrl As ScrollView
End Sub

Sub Activity_Create(FirstTime As Boolean)
'The Button is only to show the results, please don't click
'Please show the log!
scrl.Initialize(0)
pan.Initialize("pan")
pan.Color=Colors.Blue
Activity.AddView(scrl,0,0,100%x,100%y)
scrl.Panel.Width=scrl.Width
scrl.Panel.Height=scrl.Height
scrl.Panel.AddView(pan,0,0,scrl.Width,scrl.Height)
but.Initialize("")
pan.AddView(but,50,50,60,60)
End Sub

Sub pan_Touch (Action As Int, X As Float, Y As Float)
Select Action
Case 0 ' ACTION_DOWN
Log("ACTION_DOWN")
Log("pTop=" & Y) 'pTop)
Case 2 ' ACTION_MOVE
Log("ACTION_MOVE")
but.Top=Y
but.Left=X
Log("x=" & X & ", y=" & Y)
Case 1 ' ACTION_UP
Log("ACTION_UP")
Case Else
Log("Else:" & Action)
End Select
End Sub
 

Attachments

  • TouchTest.zip
    5.1 KB · Views: 246

TommyE28

Member
Licensed User
Longtime User
I have a scrolview with added panels. I want to touch a line and move to another position, up or down inside the scrolview.
 
Upvote 0

TommyE28

Member
Licensed User
Longtime User
Thanks for the tip, but my intention is to touch and move the row with my finger to use. In the example you use up and down buttons, I do not want so.
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
Your must explain your problem more precicely !
What exactly do you want do do ?
The request you expose, as Erel already told you, is impossible like you want it.
In a scrollview the vertical move is used by the scrollview to move the internal panel, so you cant use this event for something else. You could put a transparent Panel over the scrollview to do what you want to do, but you loose the scrollview functionality, so why using a scrollview.
In your example the internal panel height is equal to the scrollview height, is this always the case? If yes scrollview is not the best solution. A panel with internal panels would do it.
So without knowing more details onwhat you want to do it's almost impossible to give you a concrete advice.

Best regards.
 
Upvote 0

TommyE28

Member
Licensed User
Longtime User
I have a "datatable" (scrollview with panels as rows). My intention is to touch a row and move to a another position inside the table. This works in a panel but not in a scrolview. The reasons i understand, but I am looking for a solutions.
I tried to create a transparent panel over the entire screen. But i don't know how I can pass the touch event to the new panel without a second touch to trigger the touchevent for the new generated panel.
Mean: First touch to generate the panel in foreground and second touch to move the row(i will do all with one touch)

Best regards.
 
Upvote 0

Inman

Well-Known Member
Licensed User
Longtime User
I am facing a similar issue. I need to track Touch event for ScrollView. I tried putting ScrollView inside Panel but still no good. I have a scrollable set of data to present. I looked up on ListView as well but it also doesn't have Touch event.

Is there any solution to this?
 
Upvote 0
Top