Mouse Icon
Posted: Mon Oct 27, 2025 8:17 pm
How can I disable the cursor icon above editorgadget() and put my own icon?
Here is an example of Shardik, but when you hover over editorgadget, it becomes standard.
Here is an example of Shardik, but when you hover over editorgadget, it becomes standard.
Code: Select all
Define Hotspot.NSPoint
OpenWindow(0, 200, 100, 290, 300, "Display custom cursor")
ButtonGadget(0, WindowWidth(0) / 2 - 120, 40, 240, 25, "Change cursor to custom image")
EditorGadget(1,50,150,100,100)
UsePNGImageDecoder()
If LoadImage(0, #PB_Compiler_Home + "Examples/Sources/Data/World.png")
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Break
Case #PB_Event_Gadget
If EventGadget() = 0 And EventType() = #PB_EventType_LeftClick
Hotspot\x = 4
Hotspot\y = 4
NewCursor = CocoaMessage(0, 0, "NSCursor alloc")
CocoaMessage(0, NewCursor, "initWithImage:", ImageID(0), "hotSpot:@", @Hotspot)
CocoaMessage(0, NewCursor, "set")
EndIf
EndSelect
ForEver
EndIf