How to change WebControl's cursor?

In a WebApp, I have a WebImageViewer that when pressed will open an URL.
Screenshot 2022-11-21 at 00.38.29

I want to change the cursor of the control to a finger pointer.

Unfortunately the following in the Open event does not compile.

Me.Cursor = System.WebCursors.FingerPointer

What am I missing?

  • I can confirm your results.
  • it looks like a documentation bug. If you use typeahead you will see there is a Cursor property as part of Style:

  • but it does not compile, either:

This code will compile:

WebImageViewer1.Opening
  dim x as integer = system.WebCursors.FingerPointer 
  me.style.Cursor = WebStyle.Cursors(x)

But seems to have no effect in the browser.

Submitted as #70938

Until the bugs are fixed you can add this line to the opening event of your WebImageViewer:

me.Style.Value("cursor") = "pointer"

pointer.2022-11-20 19_12_24

3 Likes

This is the correct way to specify the cursor. The values are in an enum, the name of the enum is system.WebCursors and the specific value for the enum is FingerPointer.

As to why it doesn’t work, I don’t have the answer, maybe the documentation can be of help. Lets see:

Sample code

The following code changes the pointer to a Finger Pointer when it is moved into the region of the control.

Me.Cursor = System.WebCursors.FingerPointer

In this example, Me is the WebImageViewer.

This works:

Me.Style.Cursor = WebStyle.Cursors.Pointer

It looks like the documentation needs an update.

1 Like

@MVP
i think xojo should generate the help/doc by extracting source code from a compiled example app.
in the same time the whole example could be linked in the documentation.