Hi. i'm trying to find ImageSlider view by Tag. When i wrote code as below i got a warning "Types does not match".
How can i set ImageSlider view with return view of FindViewByTag function
Any help ?
B4X:
Dim slider As ImageSlider= FindViewByTag(p,"ImageSliderX") ' Types does not match".
Sub FindViewByTag(Parent As Panel, Name As String) As View
Try
For Each v As View In Parent.GetAllviewsRecursive
If Name = v.Tag And v Is ImageView Then
Return v
End If
If Name = v.Tag And v Is TextView Then
Return v
End If
If Name = v.Tag And v Is TextField Then
Return v
End If
If Name = v.Tag And v Is Button Then
Return v
End If
If Name = v.Tag And v Is Picker Then
Return v
End If
If Name = v.Tag And v Is Label Then
Return v
End If
If Name = v.Tag And v Is ImageView Then
Return v
End If
If Name = v.Tag And v Is Switch Then
Return v
End If
If Name = v.Tag And v Is Panel Then
Return v
End If
If Name = "ImageSliderX" Then '***** It's works but i cant set view by imageslider
Return v
End If
Next
Catch
'Showerror("FindViewByTag:" & LastException )
End Try
End Sub
Sub FindViewByTag(Parent As Panel, Name As String) As View
For Each v As View In Parent.GetAllviewsRecursive
If Name = v.Tag Then
Return v
Next
Return Null
End Sub
There is no reason for these type checks.
2. ImageSlider is not a view by itself. A simple way to get an ImageSlider based on its name is with a global Map that maps between the name and the ImageSlider.
Sub FindViewByTag(Parent As Panel, Name As String) As View
For Each v As View In Parent.GetAllviewsRecursive
If Name = v.Tag Then
Return v
Next
Return Null
End Sub
There is no reason for these type checks.
2. ImageSlider is not a view by itself. A simple way to get an ImageSlider based on its name is with a global Map that maps between the name and the ImageSlider.
I think my English is not enough how to explain well what is my problem. I created an example project about what is my problem. Code doesn't work well (cant add correct images and cant slide ). Could you run the code and try slide images in imageslider?