Sender of door library event

ExcludeReality

Active Member
Licensed User
Hello.
I've tied several controls to an event using the door library.
I'd like to know which of the controls triggered the event.

The Sender keyword doesn't work, and neither does Obj.GetProperty ("Sender").

Does anyone know how to do this?
Thanks.
 

agraham

Expert
Licensed User
Longtime User
I've tied several controls to an event using the door library.
How are you doing this? Usually one Door library Event object handles one event for one control and the name of the Event object will identify the source. You can't get the original event raising control because the Sender, as far as the Basic4ppc event handling code sees it, is the Door library Event object and I can't see a way round this.
 

ExcludeReality

Active Member
Licensed User
How are you doing this?

B4X:
Obj.FromControl ("control1")
DoorEvent.New1 (Obj.Value,"MouseMove")

Obj.FromControl ("control2")
DoorEvent.New1 (Obj.Value,"MouseMove")

Obj.FromControl ("control3")
DoorEvent.New1 (Obj.Value,"MouseMove")

The event itself works good.
So are you saying there's no way to get the sender property?
 

ExcludeReality

Active Member
Licensed User
Thanks for your reply.

I can't have seperate events for each control because I add new controls in runtime.
I supose I can use AddObject to add an event, but since each event has an individual sub, I also need to add the sub in runtime (which is not possible).

Any ideas?
 

agraham

Expert
Licensed User
Longtime User
This seems to work with Sender identifying the Event object
B4X:
Sub App_Start
   Form1.Show
   Obj.New1(False)
   AddObject("Event1", "Event")
   Obj.FromControl("Form1")
   Control("Event1").new1(obj.Value,"MouseDown")
   AddEvent("Event1", NewEvent, "CommonEventSub")   
End Sub


Sub CommonEventSub
   Msgbox(Sender)
End Sub
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…