Mouse Icon

Mac OSX specific forum
User avatar
rndrei
Enthusiast
Enthusiast
Posts: 185
Joined: Thu Dec 28, 2023 9:04 pm

Mouse Icon

Post by rndrei »

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.

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