Scrollview Item Selected

Bill Norris

Active Member
Licensed User
Longtime User
Ok, I am at a standstill. I've dug and dug through other posts and examples and its just not sinking in. My actual app is much more involved, but I'll break it down for simplicity,

One scrollview, named SV1, with 10 labels added vertically at runtime. the labels names are lbl(0) thru lbl(9).

Each label has it's tag property set to the value of its index.

The event name of SV1 is SV1_Click.

I want to change background color of the label that is touched, and get the tag value from that same label.

That's it in a nutshell. Thanks in advance for assistance.
 

joseluis

Active Member
Licensed User
Longtime User
You must initialize the labels with the same event name. Then you need 1 sub that uses Sender keyword to retrieve the specific label. e.g.

B4X:
 Sub Label_Click
   Dim Send As Label
   Send=Sender
   Send.Color = Colors.Blue
   log(Send.Tag)
End Sub
 
Upvote 0
Top