It is currently Sun Apr 23, 2017 10:42 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: canvas change cursor
PostPosted: Fri Dec 02, 2016 2:18 pm 
Offline
Enthusiast
Enthusiast

Joined: Thu May 30, 2013 4:39 pm
Posts: 253
The mouse cursor change on leaving the canvas. I think that makes no sense, because the developer has no influence on it and it will not
automatically change back on enter.

Code:
Global Window_0, Canvas, NewCursor

Procedure ChangeCurser()

    Cursor = CreateImage(#PB_Any, 30, 30)

    Hotspot.NSPoint
    Hotspot\x = 15
    Hotspot\y = 10
   
    NewCursor = CocoaMessage(0, 0, "NSCursor alloc")
    CocoaMessage(0, NewCursor, "initWithImage:", ImageID(Cursor), "hotSpot:@", @Hotspot)
    CocoaMessage(0, NewCursor, "set")

EndProcedure


Procedure Window_0_Events(event)
  Select event
    Case #PB_Event_CloseWindow
      ProcedureReturn #False

    Case #PB_Event_Menu
      Select EventMenu()
   Case #PB_Menu_Quit
          ProcedureReturn #False
      EndSelect

    Case #PB_Event_Gadget
      Select EventGadget()
        Case Canvas
          If EventType() = #PB_EventType_LeftButtonDown
            ChangeCurser()
          EndIf
         
         
      EndSelect
  EndSelect
  ProcedureReturn #True
EndProcedure


  Window_0 = OpenWindow(#PB_Any, x, y, 200, 120, "", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  Canvas = CanvasGadget(#PB_Any, 10, 10, 180, 100)
 
  Repeat
   
  Until WaitWindowEvent() = 4
 
ChangeCurser()

Repeat
  event = WaitWindowEvent()
Until Window_0_Events(event) = #False


Top
 Profile  
Reply with quote  
 Post subject: Re: canvas change cursor
PostPosted: Wed Feb 15, 2017 9:20 am 
Offline
Administrator
Administrator

Joined: Fri May 17, 2002 4:39 pm
Posts: 12942
Location: France
It's the expected behaviour


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