mouseleave on canvas-gadget ( intel mac ) ( pb 4.60 b3 )

Just starting out? Need help? Post your questions and find answers here.
delikanli_19_82
User
User
Posts: 38
Joined: Tue Jun 21, 2011 6:11 pm

mouseleave on canvas-gadget ( intel mac ) ( pb 4.60 b3 )

Post by delikanli_19_82 »

hello guys,

i think, this is a bug, but before i report it as a bug, i do what freak says in his article about bugs. maybe its really a knowledge leck.

here the problem:

the MouseLeave-Event on Mac OS X doens't work, while it works without any problem on windows and linux.

Here my system information:

Mac OS X Snow Leopard ( 10.6.7 ) German, Intel x86.

PureBasic 4.60 Beta 3 x68.

No subsystem selected. Standard settings.

test code:

Code: Select all

Enumeration
  #window = 0
  #canvas = 1
EndEnumeration

Define event.l

OpenWindow( #window, 0, 0, 100, 100, "Canvas-Prob", #PB_Window_SystemMenu | #PB_Window_ScreenCentered )

CanvasGadget( #canvas, 10, 10, 80, 80 )

StartDrawing( CanvasOutput( #canvas ) )
  Box( 0, 0, 80, 80, RGB( 70, 70, 130 ) )
StopDrawing()

Repeat
  
  event = WaitWindowEvent()
  
  If event = #PB_Event_Gadget And EventGadget() = #canvas
    
    Select EventType()
        
      Case #PB_EventType_MouseEnter
        
        SetWindowTitle( #window, "On" )
        
      Case #PB_EventType_MouseLeave
        
        SetWindowTitle( #window, "Off" )
        
    EndSelect
    
  EndIf
  
Until event = #PB_Event_CloseWindow
any ideas?
jamirokwai
Enthusiast
Enthusiast
Posts: 796
Joined: Tue May 20, 2008 2:12 am
Location: Cologne, Germany
Contact:

Re: mouseleave on canvas-gadget ( intel mac ) ( pb 4.60 b3 )

Post by jamirokwai »

Hi there,

seems to be a bug. If you make the window 200x200 px, the off-event for mouse_leave does not fire.
Regards,
JamiroKwai
User avatar
Shardik
Addict
Addict
Posts: 2058
Joined: Thu Apr 21, 2005 2:38 pm
Location: Germany

Re: mouseleave on canvas-gadget ( intel mac ) ( pb 4.60 b3 )

Post by Shardik »

As long as this bug is not fixed you may use this workaround:
http://www.purebasic.fr/english/viewtop ... 93&start=1
User avatar
Demivec
Addict
Addict
Posts: 4260
Joined: Mon Jul 25, 2005 3:51 pm
Location: Utah, USA

Re: mouseleave on canvas-gadget ( intel mac ) ( pb 4.60 b3 )

Post by Demivec »

delikanli_19_82 wrote:the MouseLeave-Event on Mac OS X doens't work, while it works without any problem on windows and linux.
PB Manual on the topic of CanvasGadget wrote:On Windows and Linux, mouse events are reported while the mouse is down even if the mouse leaves the gadget. This ensures that a mouse down event is paired with a corresponding mouse up event even if the mouse is released outside of the gadget area. On Mac OSX, there are no events reported while the mouse is outside of the gadget, so it is possible to miss the mouse up event. A solution to this problem is to watch for the #PB_EventType_MouseLeave event and treat that as a mouse up event or to clip the mouse to the gadget area while the mouse is down, which ensures that the mouse up event is received.
Not a bug.
Post Reply