It is currently Tue Nov 19, 2019 6:59 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: [Done] OpenGLGadget and #PB_OpenGL_CustomCursor
PostPosted: Mon Jun 17, 2019 7:47 am 
Offline
Enthusiast
Enthusiast

Joined: Thu Dec 29, 2011 5:03 pm
Posts: 500
To borrow Shardik's example to demonstrate, the same problem occurs with the OpenGLGadget:
Quote:
SetGadgetAttribute(#Gadget, #PB_Canvas_CustomCursor, *CustomCursor) doesn't work on MacOS (it works like a charm on Linux and Windows). When moving the default arrow cursor into the CanvasGadget, the cursor should change into a world image. When moving the cursor out of the CanvasGadget, the default arrow cursor should be shown again.
Code:
EnableExplicit

Define *CustomCursor
Define Hotspot.NSPoint

UsePNGImageDecoder()

If LoadImage(0, #PB_Compiler_Home + "Examples/Sources/Data/World.png")
  ; ----- Create custom cursor
  Hotspot\x = 4
  Hotspot\y = 4
  *CustomCursor = CocoaMessage(0, 0, "NSCursor alloc")
  CocoaMessage(0, *CustomCursor,
    "initWithImage:", ImageID(0),
    "hotSpot:@", @Hotspot)

  OpenWindow(0, 270, 100, 250, 170, "Canvas with custom cursor")
  OpenGLGadget(0, 10, 10, 230, 80, #PB_Canvas_Border)
  SetGadgetAttribute(0, #PB_OpenGL_CustomCursor, *CustomCursor)

  ; ----- #PB_OpenGL_Cursor is working correctly (uncomment to test)
   ;SetGadgetAttribute(0, #PB_OpenGL_Cursor, #PB_Cursor_Hand)

  Repeat
    Select WaitWindowEvent()
      Case #PB_Event_CloseWindow
        Break
      Case #PB_Event_Gadget
        If EventGadget() = 0 And EventType() = #PB_EventType_LeftClick
          CocoaMessage(0, *CustomCursor, "set")
        EndIf
    EndSelect
  ForEver
EndIf


Top
 Profile  
Reply with quote  
 Post subject: Re: OpenGLGadget and #PB_OpenGL_CustomCursor
PostPosted: Fri Aug 09, 2019 12:58 pm 
Offline
Administrator
Administrator

Joined: Fri May 17, 2002 4:39 pm
Posts: 13627
Location: France
Fixed.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye