TWebGMaps cursor

Why can't the cursor be changed in the TWebGMaps component? I'm using Delphi 10 Seattle software

Hi,


Please note that this is a limitation of the TWebBrowser control which the TWebGMaps component is based on.
I'm sorry, but I have to dispute your reply.
This is not a limitation of TWebBrowser, but a "feature" of the Google Maps API.
But this could be changed easily, as you can see in the screenshot below (crosshairs instead of hand):


As long as the MapOption "draggableCursor" is not published through TWebGMaps, you have to change the source of UWebGMapsConst.pas and add the appropriate MapOption in the JavaScript code (in my source e.g. in lines 1480ff):

...
                '   scrollwheel: %scrollwheel%,' + #13 +
                '   draggableCursor: ''crosshair'',' + #13 +
                '   disableDefaultUI: %disableDefaultUI%,' + #13 +
...
Here's what the Google Maps API docs say:

draggableCursor
Type:  string
The name or url of the cursor to display when mousing over a draggable map. This property uses the css cursor attribute to change the icon. As with the css property, you must specify at least one fallback cursor that is not a URL. For example: draggableCursor: 'url(http://www.example.com/icon.png), auto;'.

Cursor types are:
  • auto
  • default
  • hand
  • move
  • crosshair
and probably more...

Hi,


I was assuming the OP was referring to changing the cursor by using Screen.Cursor. In that case the changed cursor will not be displayed when hovering over a TWebGMaps or TWebBrowser control but rather the cursor that is defined by the HTML displayed inside the control.

However, it's a good suggestion to use the built-in option of the Google Maps JavaScript API and we'll investigate if this can be supported in a future version of TMS VCL WebGMaps.

Thank you Stefan, I just wanted that feature!

Implementing this as a property was piece of cake, maybe 10 lines of code.
You can select and set the cursor type at design and runtime (see combobox as the bottom):

This feature has now been implemented.
The update will be available with the next release of TMS VCL WebGMaps.

I'm anxious to compare your with my own implementation...

I've checked your implementation of TMapCursor and just a minor enhancement would be possible.
The cursor "mcDefault" is a pointed arrow, not the grabbing hand, that is the default on GoogleMaps.
This could be easily added with another enum mcEmpty = '', that should be set as the default setting.

Thank you for notifying.
The extra option will be added with the next release.

Another good and suitable cursor would be mcAllScroll = 'all-scroll'.

We will also include this as an extra cursor type with the next release.


Please note that you can use mcMove instead which displays the same cursor as 'all-scroll' would.

Please note that you can use mcMove instead which displays the same cursor as 'all-scroll' would.
[/QUOTE]

It looks similar, but it's not the same.

   


Thank you for clarifying.
The mcAllScroll option has been added and will be available with the next TMS VCL WebGMaps release.