need very simple way to scroll a panel ???

ilan

Expert
Licensed User
Longtime User
hi

i have a panel and i want to scroll it to the left and to the right
it should be very simple
i tried to understand the sample project that i found here but i cant understand anything

i just want a very simple code
like

panel1.down

panel1.left = panel-x


just to move it if i touch it

thanx
 

Informatix

Expert
Licensed User
Longtime User
hi

i have a panel and i want to scroll it to the left and to the right
it should be very simple
i tried to understand the sample project that i found here but i cant understand anything

i just want a very simple code
like

panel1.down

panel1.left = panel-x


just to move it if i touch it

thanx

The simplest code:

B4X:
' Initialization
Dim pnl As Panel
pnl.Initialize("MyPanel")
pnl.Color = Colors.Magenta
Activity.AddView(pnl, 50dip, 50dip, 200dip, 200dip)

B4X:
' Handler for the Touch event
Sub MyPanel_Touch (Action As Int, X As Float, Y As Float)
   Dim pnl As Panel
   pnl = Sender
   If Action = 0 Then ' DOWN
      '...
   Else If Action = 2 Then ' MOVE
      pnl.Left = pnl.Left + X
      pnl.Top = pnl.Top + Y
   Else If Action = 1 Then ' UP
      '...
   End If
End Sub
 
Upvote 0
Top