Jump to content

Javascript event sender in ajaxRequest


fpiette

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.

 

Link to comment
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,

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...