Jump to content
uniGUI Discussion Forums
fpiette

Javascript event sender in ajaxRequest

Recommended Posts

Hello,

 

In the sample Google Maps demo included with uniGUI, I added several markers on the map. Then I add an event listener which do an ajaxRequest against MainForm.UniHTMLFrame1. Then in Delphi code, I handle the event. This works very well.

 

My question is: since the same event is used for several markers, I would like to pass the marker to the event Handler, much like "sender" in Delphi VCL. How to do that ?

 

Excerpt form my code:

 

Javascript:

 

marker.addListener('dragend',

  function(e) {

    ajaxRequest(MainForm.UniHTMLFrame1,

     'markerDragEnd',

     ['lat='+e.latLng.lat(), 'lng='+e.latLng.lng()]);

  }

 

Delphi code (In TMainForm.UniHTMLFrame1AjaxEvent)::

 

if EventName = 'markerDragEnd' then

  UniLabel1.caption := 'Lat: '+Params.Values['lat'] +', ' + Params.Values['lng'];

 

Thanks.

 

Share this post


Link to post
Share on other sites

Hi,

 

In the sample Google Maps demo included with uniGUI, I added several markers on the map. Then I add an event listener which do an ajaxRequest against MainForm.UniHTMLFrame1. Then in Delphi code, I handle the event. This works very well.

 

My question is: since the same event is used for several markers, I would like to pass the marker to the event Handler, much like "sender" in Delphi VCL. How to do that ?

 

Can you make a simple testcase for this ?!

 

Best regards,

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×