scrollview, event array

exjey

Member
Licensed User
Longtime User
Thanks to many samples in this forum i managed to load the way i want many items in a scrollview by using .AddView (MyPanel, .... ) in each loop and taking care all the properties of MyPanel.

I want for each line in scrollview to have one event procedure following by an index parameter, is this possible? Not many event procedures because the number of the total items (panels) in scrollview is basically unknown.

Like that:

Sub PanelInScrollViewClicked_Click(Index As Int)

How to declare a sub like this and use it when the user clicks on a specific item in my scrollview?

EDIT: Or BETTER, i want the Panel reference as parameter, not just a generic serial number (Index). Because i can use then all the properties of the selected MyPanel... Or maybe there is a way to access the MyPanel collection just by the Index integer.... sorry for these questions, i am a vb expert and i am a bit lost with B4A, but its only the second day.... i am getting better :)
 
Last edited:

stevel05

Expert
Licensed User
Longtime User
Set the event for each panel to PanelInScrollViewClicked when you initialize it in code, then look at sender.

Sub will be something like:

B4X:
Sub PanelInScrollViewClicked_Click

     Dim P As Panel
     P = Sender

End Sub

P will have the object that is clicked, so if you use the tag in the panel you can do.

B4X:
If P.Tag = ??? Then
...
End if
 
Last edited:
Upvote 0
Top