It is currently Sat Dec 16, 2017 7:40 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: [Done] SetGadgetAttribute fails with #PB_Canvas_CustomCursor
PostPosted: Sat Oct 14, 2017 6:12 pm 
Offline
Addict
Addict
User avatar

Joined: Thu Apr 21, 2005 2:38 pm
Posts: 1466
Location: Germany
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.

I tested the following failing example on these two MacOS operating systems:
- 10.6.8 'Snow Leopard' with PB 5.45 x86 in ASCII and Unicode mode and with PB 5.61 x86
- 10.13 'High Sierra' with PB 5.45 x86 and x64 in ASCII and Unicode mode and with PB 5.61 x86 and x64

The created custom cursor is a valid one: just try to left click into the CanvasGadget and the custom cursor (world image) will be shown.

SetGadgetAttribute() is working fine with #PB_Canvas_Cursor: just uncomment that line and the predefined hand cursor will be shown.
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")
  CanvasGadget(0, 10, 10, 230, 80, #PB_Canvas_Border)
  SetGadgetAttribute(0, #PB_Canvas_CustomCursor, *CustomCursor)

  ; ----- #PB_Canvas_Cursor is working correctly (uncomment to test)
  ; SetGadgetAttribute(0, #PB_Canvas_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

Wolfram posted already a similar example demonstrating this error in the Mac OSX subforum 11 months ago!


Top
 Profile  
Reply with quote  
 Post subject: Re: SetGadgetAttribute() fails with #PB_Canvas_CustomCursor
PostPosted: Thu Nov 02, 2017 10:06 pm 
Offline
PureBasic Team
PureBasic Team
User avatar

Joined: Fri Apr 25, 2003 5:21 pm
Posts: 5747
Location: Germany
fixed.

_________________
quidquid Latine dictum sit altum videtur


Top
 Profile  
Reply with quote  
 Post subject: Re: [Done] SetGadgetAttribute fails with #PB_Canvas_CustomCu
PostPosted: Wed Nov 29, 2017 4:02 am 
Offline
Addict
Addict
User avatar

Joined: Sun Apr 27, 2003 8:12 am
Posts: 1966
Location: USA
On Snow Leopard using PB 5.61 x86 works just fine if I comment out...
Code:
;And EventType() = #PB_EventType_LeftClick

Maybe the following works for you?
Code:
Case #PB_Event_Gadget
        If EventGadget() = 0
          CocoaMessage(0, *CustomCursor, "set")
          If EventType() = #PB_EventType_LeftClick
            Debug "Hello"
          EndIf
        EndIf

I do see where #PB_Canvas_CustomCursor is not working without the CocoaMessage() though. Might as well comment out line 19 too until this is fixed. That's if, anyone is using it right now. ;)

_________________
www.posemotion.com

PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef

Mac: 10.9.5 / 1.4GHz Core 2 Duo / 2GB DDR3 / Nvidia 320M
PC: XP SP3 / AMD 64 4000+ / 1GB DDR / ATI 9250


Even the vine knows it surroundings but the man with eyes does not.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 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