CGDevTools Forum

Welcome to the Official CGDevTools Support Community Forums.

OnClick: Which marker is selected?

by FrancescoPierobon » 27 Oct 2013 09:59

With JQUeryDemo_V2, TIWCGJQGMap3 example, function MultiMarkers: is there a way to know on which marker the user has put the mouse if the event MultiMarkerMouseOverEvent is fired?

Thank you very much for your help.
FrancescoPierobon
 
Posts: 17
Joined: 14 Jul 2013 15:40

by Alexander Bulei » 28 Oct 2013 11:01

Hi FrancescoPierobon,

With JQUeryDemo_V2, TIWCGJQGMap3 example, function MultiMarkers: is there a way to know on which marker the user has put the mouse if the event MultiMarkerMouseOverEvent is fired?


Yes, you can,

  1. You need set "ID" for marker.

    Example:

    delphi code
    LMarker:= Marker.Values.Add;
    LMarker.Id:= 'mymarkerID_2'; // unique ID
    LMarker.Data:= 'Mealhada';
    LMarker.LatLng.Latitude:= 40.36267630;
    LMarker.LatLng.Longitude:= -8.453534200000002;

  2. Add new BrowserParam to event:

    Example:

    delphi code
    procedure TIWForm1.IWAppFormCreate(Sender: TObject);
    var
    LMarker: TIWCGJQGMap3MultipleMarker;
    begin
    with IWCGJQGMap3.JQGMapV3Options do
    begin
    Map.Options.Zoom:= 6;
    Map.Options.Center.Latitude:= 40.36267630;
    Map.Options.Center.Longitude:= -8.453534200000002;
    Map.Options.Draggable:= False;
    {MEALHADA}
    LMarker:= Marker.Values.Add;
    LMarker.Id:= 'mymarkerID_2';
    LMarker.Data:= 'Mealhada';
    LMarker.LatLng.Latitude:= 40.36267630;
    LMarker.LatLng.Longitude:= -8.453534200000002;
    with LMarker.Events.OnMouseOver.BrowserParams.Add do
    begin
    ServerName:= 'markerid';
    BrowserScript:= 'context.id';
    end;
    end;
    end;

  3. To get the marker id, do this in MouseOver event:

    delphi code
    procedure TIWForm1.IWCGJQGMap3JQGMapV3OptionsMarkerEventsMouseOver(Sender: TObject; AParams: TStringList);
    var
    MyMarkerId: string;
    begin
    MyMarkerId:= AParams.Values['markerid'];
    { your code here }
    end;



Best Rgeards.
Group: Developers | Support Team

  • info [at] cgdevtools.com - General information
  • sales [at] cgdevtools.com - Sales department
  • support [at] cgdevtools.com - Product and Technical Support
User avatar
Alexander Bulei
Site Admin
 
Posts: 3635
Joined: 15 May 2012 08:52
Location: Mealhada, Portugal

by FrancescoPierobon » 28 Oct 2013 16:04

Hi CGDevTools,

Thank you very much for your great support that will distinguish from others and for which it is really worth to invest on your components.

Francesco Pierobon
http://www.webcolf.com
FrancescoPierobon
 
Posts: 17
Joined: 14 Jul 2013 15:40

by FredT » 28 Mar 2019 16:33

Hi,

I would like do the same thing with the event "OnDragEnd" but it doesn't work, the event is not fired !

LMarker:= IWCGJQGMap3.JQGMapV3Options.Marker.Values.Add;
LMarker.Data:= 'Marker 0';
LMarker.Id := '0';
LMarker.LatLng.Latitude:= 0;
LMarker.LatLng.Longitude:= 0;
LMarker.Options.Draggable := True;

with IWCGJQGMap3.JQGMapV3Options.Marker.Events.OnDragEnd.BrowserParams.Add do
begin
ServerName := 'markerid';
BrowserScript := 'context.id';
end;

Thank
FredT
 
Posts: 28
Joined: 28 Jan 2019 15:10

by Alexander Bulei » 29 Mar 2019 12:03

Hi FredT,

Check our main demo, it have example of dragend event.

Best Regards.
Group: Developers | Support Team

  • info [at] cgdevtools.com - General information
  • sales [at] cgdevtools.com - Sales department
  • support [at] cgdevtools.com - Product and Technical Support
User avatar
Alexander Bulei
Site Admin
 
Posts: 3635
Joined: 15 May 2012 08:52
Location: Mealhada, Portugal

by FredT » 29 Mar 2019 17:29

Hi,

Yes, that's what I did! But in the example there are no additional parameters.
But it is when I add one (to find the marker's id) that the event is no longer called!

Thank.
FredT
 
Posts: 28
Joined: 28 Jan 2019 15:10

by Alexander Bulei » 01 Apr 2019 09:24

Hi,

Because you have javascript error.

with IWCGJQGMap3.JQGMapV3Options.Marker.Events.OnDragEnd.BrowserParams.Add do
begin
ServerName := 'markerid';
BrowserScript := 'context.id';
end;


The function doesnt have any "context" parameter, only "marker".

Best Regards.
Group: Developers | Support Team

  • info [at] cgdevtools.com - General information
  • sales [at] cgdevtools.com - Sales department
  • support [at] cgdevtools.com - Product and Technical Support
User avatar
Alexander Bulei
Site Admin
 
Posts: 3635
Joined: 15 May 2012 08:52
Location: Mealhada, Portugal

by FredT » 01 Apr 2019 14:17

Hi,

I admit that I did not understand much about the operation of additional parameters for events. I did not find any documentation on this subject either, so:

1- How do we know that OnMouseOver has a Context parameter and not OnDragEnd?

2 - By extension, how to know the parameters usable for each event?

3 - And especially what BrowserScript should I use in OnDragEnd?
Because if I do not put BrowserScript in OnDragEnd, I get an empty string in markerid.
Same if I enter BrowserScript: = 'marker.id';
And if I put something else, the event is no longer called!

Thank.
FredT
 
Posts: 28
Joined: 28 Jan 2019 15:10

by Alexander Bulei » 01 Apr 2019 16:06

Hi FredT,

viewtopic.php?f=5&t=3843

Best Regards.
Group: Developers | Support Team

  • info [at] cgdevtools.com - General information
  • sales [at] cgdevtools.com - Sales department
  • support [at] cgdevtools.com - Product and Technical Support
User avatar
Alexander Bulei
Site Admin
 
Posts: 3635
Joined: 15 May 2012 08:52
Location: Mealhada, Portugal

by FredT » 02 Apr 2019 10:22

Hi Alexander,

Thank you so much.
FredT
 
Posts: 28
Joined: 28 Jan 2019 15:10


Return to JQGMap

cron

Who is online

Users browsing this forum: No registered users and 3 guests

Contact Us.