Jeremie_L
(Jeremie_L)
November 20, 2022, 11:57pm
1
In a WebApp, I have a WebImageViewer that when pressed will open an URL.
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?
1 Like
Mike_D
(Mike D)
November 21, 2022, 12:15am
3
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
AlbertoD
(AlbertoD)
November 21, 2022, 1:10am
4
Until the bugs are fixed you can add this line to the opening event of your WebImageViewer:
me.Style.Value("cursor") = "pointer"
4 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.
AlbertoD
(AlbertoD)
November 21, 2022, 5:04am
6
This works:
Me.Style.Cursor = WebStyle.Cursors.Pointer
It looks like the documentation needs an update.
1 Like
MarkusR
(MarkusR)
November 21, 2022, 5:52pm
7
@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.
well again, in xojo 2023r4, same problem on a webcontainer shown event …
Me.Style.Cursor = System.WebCursors.FingerPointer
gives a
Type mismatch error. Expected enum WebStyle.Cursors, but got Integer
Me.Style.Cursor = System.WebCursors.FingerPointer
Looks like you’re referencing the wrong enum.
Me.Style.Cursor = WebStyle.Cursors.Pointer
Original issue was probably fixed.
2 Likes
AlbertoD
(AlbertoD)
February 16, 2024, 12:00pm
10
Anthony beat me. I was building an example to capture a GIF to show what works (the code Anthony posted).
I asked for the documentation to be updated but hasn’t been updated. Still a copy of the old docs: https://tracker.xojo.com/xojoinc/xojo/-/issues/70938#note_544266
So I don’t know what was fixed as the bug is a documentation bug/error.
Edit: well I think there is no FingerPointer available but Pointer is what I used for my example and it works:
Me.Style.Cursor = WebStyle.Cursors.Pointer
2 Likes
I just assumed something was fixed because his post made it seem like he had code that has stopped working even though it previously did. When I use WebStyles, I provide everything as strings because I assume — but haven’t tested — it’ll be faster than transforming the name and value(s).
AlbertoD
(AlbertoD)
February 16, 2024, 12:14pm
12
Can you update your code as ‘fingerpointer’ doesn’t exist?
Here is the GIF I was working on showing that the code works:
1 Like
AlbertoD
(AlbertoD)
February 16, 2024, 12:18pm
13
In Short:
This Issue: https://tracker.xojo.com/xojoinc/xojo/-/issues/70938
Is marked as Bug Documentation Fixed
is closed.
Mentions this documentation page: WebCursors — Xojo documentation
that still have the wrong information as System.Webcursors.<whatever>
doesn’t work, we need to use WebStyle.Cursors.<options available here>
I guess we need to open a new Issue with this specific information for the page to be updated. Is only Geoff able to update the documentation?
TimStreater
(TimStreater)
February 16, 2024, 12:21pm
14
Why is it still closed? The thing to do is to re-open it.
AlbertoD
(AlbertoD)
February 16, 2024, 12:22pm
15
Only Xojo or the OP can re-open it.
@Mike_D can you reopen the issue?
1 Like
AlbertoD
(AlbertoD)
February 16, 2024, 12:38pm
16
The Hint/Help using the IDE works (if you place the mouse over cursor):
I think that is why I posted the code here back in Nov 2022. Sometimes you need to trust the IDE more than the documentation.
Edit: maybe @Jeremie_L can select one post with the working code as an answer to help others find the correct way to assign a cursor.