I have the following code in a canvas MouseMove Event. On Windows and in carbon the Cursor changes as expected when it is over the desired item… but not in Cocoa.
Bug or platform limitation?
[code]Sub MouseMove(X As Integer, Y As Integer) #If RBVersion < RBVersions.DisableAutoWaitCursor #pragma DisableAutoWaitCursor #endIf #pragma DisableBackgroundTasks #pragma DisableBoundsChecking #pragma NilObjectChecking False #pragma StackOverflowChecking FAlse
DragStatus = DropStatus.NotDragging
Dim NewOverItem as GraphDefinition.GraphItem = Graph.ClosestElement(X,Y)
Select Case NewOverItem.Type
Case GraphDefinition.Element.MajorGridX,_
GraphDefinition.Element.MajorGridY, _
GraphDefinition.Element.MinorGridX, _
GraphDefinition.Element.MinorGridY, _
GraphDefinition.Element.Legend
If Keyboard.AltKey Then
me.MouseCursor = System.Cursors.HandOpen
Else
me.MouseCursor = System.Cursors.FingerPointer
End if
Else
me.MouseCursor = NIL
End Select
If OverItem.StringValue(True) <> NewOverItem.StringValue(true) then
OverItem = NewOverItem
DisplayElement(OverItem)
End if
I just tried the relevant code in the MouseMove of a canvas :
If Keyboard.AltKey Then
me.MouseCursor = System.Cursors.HandOpen
Else
me.MouseCursor = System.Cursors.FingerPointer
End if
It works. Of course the change to HandOpen occurs only when the mouse moves so simply pressing Alt when the mouse does not move is not enough to show HandOpen. Maybe a timer would solve that.
No it does not on my machine … In Cocoa the cursor NEVER changes from the STANDARD cursor. I never even see the FingerPointer… and yes I know I should.
DisplayElement(OverItem)
That method displays the name of the item the cursor is over in a Label below the canvas , and that shows the right item.
[quote=108402:@Karen Atkocius]No it does not on my machine … In Cocoa the cursor NEVER changes from the STANDARD cursor. I never even see the FingerPointer… and yes I know I should.
DisplayElement(OverItem)
That method displays the name of the item the cursor is over in a Label below the canvas , and that shows the right item.
[/quote]
I remember replying to a question you asked about custom cursors before that did not work. Could it be that something deep down your settings prevent cursor change ? Please excuse my question, but did you try with a very simple code such as the one I posted, or the example from the LR ?
If other apps such as Safari correctly change the cursor fine on your machine, it would be surprising that the same calls from Xojo to the Cocoa framework not show any effect…
[quote=108411:@Michel Bujardet]I remember replying to a question you asked about custom cursors before that did not work.
[/quote]
I had forgotten about that, It was a different issue.
It had to do with ancient custom cursors that had been taken forward into into new versions of the IDE. They used an old internal format that was not supported in Cocoa but still was on Carbon and Windows
It turned out not to be something so deep down… It was: #pragma DisableBackgroundTasks
That did not cause an issue on Carbon or Windows but did in Cocoa… So a subtle framework difference