Android Question [Solved] Click in the XUI ImageSlider and use the image

Erel

B4X founder
Staff member
Licensed User
Longtime User
You can change CheckTouchGesture to:
B4X:
Private Sub CheckTouchGesture(EndX As Float)
   If EndX > MousePressedX + 50dip Then
       PrevImage
   Else if EndX < MousePressedX - 50dip Then
       NextImage
   Else
       Log("Clicked")
       CallSub2(mCallBack, mEventName & "_Click", CurrentIndex)
   End If
End Sub

The event sub should be:
B4X:
Sub ImageSlider1_Click (Index As Int)
 
Upvote 0

asales

Expert
Licensed User
Longtime User
I change the code in this sub (ImageSlide 1.11):
B4X:
Private Sub WindowBase_Touch (Action As Int, X As Float, Y As Float)

and this works fine:
B4X:
Sub ImageSlider1_Click (Index As Int)
    Log(Index)   
End Sub

but I don't know how to the the image of index in the click:
B4X:
Sub ImageSlider1_Click (Index As Int)
   Log(Index)   
   ImageView1.Bitmap = ImageSlider1.??? (Index)  'Bitmap in the index ??
End Sub
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
but I don't know how to the the image of index in the click:
Two options:

1. You set if before. So you should be able to set it again.

2. Make CurrentPanel a public variable and get the image with:
B4X:
Dim iv As ImageView = ImageSlider1.CurrentPanel.GetView(0)
Dim b As Bitmap = iv.Bitmap
 
Upvote 0

asales

Expert
Licensed User
Longtime User
I like your idea of click event. Could you please post the revised ImageSlider class module with your revisions. I could not follow the changes that you and Erel are making back and forth.
Thanks

Here.
I marked the changes with: '*** CHANGED 1.12
B4X:
Sub ImageSlider1_Click (Index As Int)
    Log(Index)
    MyImage = ImageSlider1.CurrentPanel.GetView(0)
    Dim b As Bitmap = MyImage.Bitmap
End Sub
 

Attachments

  • ImageSlider.bas
    6.7 KB · Views: 149
Upvote 0
Top