Fetching events by Sender object

prokli

Active Member
Licensed User
Longtime User
I fear that my question is a real beginners question, but nevertheless.
How can I handle the Click event of these labels which I have created by the designer (not programmatically!!).

That means: I have added up to 20 labels to my layout, declared these labels by a "Dim" statement inside my activity and load this layout when activity gets created.
The labels are named "Lbl1, Lbl2… Lbl20".
Furthermore I created a event procedure which uses "Sender" to fetch the labels click events:

Sub Label_Click
Dim Lbl as Label

Lbl = Sender
……..
End Sub

Unfortunately clicking on any of these label does not call this event procedure. I guess that this method cannot work since each label has its individual event name?!
But initializing each label by an explicit statement like Lbl1.Initialize("Label") does not work either.

Any solution?
Regards, Harald
 

Jost aus Soest

Active Member
Licensed User
Longtime User
In the Designer you must set the "Event Name" for all your labels to the same content (e. g. "Label").

Set the "Tag" for all these Labels to different values. Than use the .Tag-property in code to distinguish your labels.
Of course, when all your labels have different "Text", you can also use this property.
 
Upvote 0

prokli

Active Member
Licensed User
Longtime User
Thanks to everybody!
I forgot that the designer allows also to set the name of the event name.

Danke Jost!
Harald
 
Upvote 0
Top