Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Thu Nov 15, 2018 9:50 am
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: Mouse enter/exit event does not fire on window's bar
PostPosted: Tue Nov 20, 2012 9:41 pm 
Offline

Joined: Mon Oct 09, 2006 9:05 am
Posts: 145
The window's bar(20px) is not part of the window.

The mouse enter/exit event fires only below the bar.

Is there a way to get it ride when the mouse does enter/exit also the window's bar?

Thanks in advance.

_________________
Working system: Mac OS X 10.6.x
_________________________________
Note : I am not interested in any solutions that need custom Plug-ins of any kind


Top
 Profile  
Reply with quote  
 Post subject: Re: Mouse enter/exit event does not fire on window's bar
PostPosted: Tue Nov 20, 2012 10:40 pm 
Offline
User avatar

Joined: Thu Feb 16, 2006 10:04 pm
Posts: 262
Man, that's a funny request ... :)

This is a bit of a hack, but should work. Have a timer, mode set to 0, in its' Action() event place this code.
Dim myWindow As Ptr = Ptr(Self.Handle)
Dim aPoint As NSPoint

Declare Function MouseLocation Lib "Cocoa" Selector "mouseLocationOutsideOfEventStream" (target As Ptr) As NSPoint
aPoint = MouseLocation(myWindow)

Add the Structure.
NSPoint
x As Single
y As Single

Now you have a point location. This is for Cocoa. You'll have to fool around with the "y" location, its' origin is bottom left. But once you get this point you can do a If statement and raise some sort of flag or your own event when the conditions are true.

_________________
Thomas C.
Real Studio Blog
http://bigdaddysurf.com/blog/

https://itunes.apple.com/us/app/maui-dragstrip-2013/id604516033?mt=8
https://itunes.apple.com/us/book/how-to-waterstart/id576214730?mt=11


Top
 Profile  
Reply with quote  
 Post subject: Re: Mouse enter/exit event does not fire on window's bar
PostPosted: Wed Nov 21, 2012 10:29 am 
Offline

Joined: Mon Oct 09, 2006 9:05 am
Posts: 145
Thank you, mauitom.
mauitom wrote:
... Have a timer, mode set to 0, in its' Action() event place this code.


I followed your instruction and got it finally work. But you need to set the mode of timer to 2(multi) and the period to 1 (1ms sampling rate for a smooth detection). :wink:
Inside the timer action(), I also put an if statement which set a flag.

Do you know a similar declare for carbon?

_________________
Working system: Mac OS X 10.6.x
_________________________________
Note : I am not interested in any solutions that need custom Plug-ins of any kind


Top
 Profile  
Reply with quote  
 Post subject: Re: Mouse enter/exit event does not fire on window's bar
PostPosted: Wed Nov 21, 2012 11:55 am 
Offline
User avatar

Joined: Thu Feb 16, 2006 10:04 pm
Posts: 262
Yeah, I ment period not mode. I'll look for something on the carbon side and let u know.


Last edited by mauitom on Thu Nov 22, 2012 1:38 am, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: Mouse enter/exit event does not fire on window's bar
PostPosted: Thu Nov 22, 2012 1:36 am 
Offline
User avatar

Joined: Thu Feb 16, 2006 10:04 pm
Posts: 262
Try this ...
Declare Function CGEventCreate Lib "Carbon" (source As Ptr) As Ptr
Dim aPtr As Ptr
aPtr = CGEventCreate(Nil)
Declare Function CGEventGetLocation Lib "Carbon" (theEvent As Ptr) As CGPoint
Dim aPoint As CGPoint
aPoint = CGEventGetLocation(aPtr)

The y coord in Carbon is top left. CGPoint is defined the same as NSPoint. Your checks in the mail, right? ... :-)


Top
 Profile  
Reply with quote  
 Post subject: Re: Mouse enter/exit event does not fire on window's bar
PostPosted: Fri Nov 23, 2012 11:03 am 
Offline

Joined: Mon Oct 09, 2006 9:05 am
Posts: 145
mauitom wrote:
Declare Function CGEventCreate Lib "Carbon" (source As Ptr) As Ptr
Dim aPtr As Ptr
aPtr = CGEventCreate(Nil)
Declare Function CGEventGetLocation Lib "Carbon" (theEvent As Ptr) As CGPoint
Dim aPoint As CGPoint
aPoint = CGEventGetLocation(aPtr)

Thank you, mauitom.

I setup a new carbon project and tried the code with corresponding timer and structure But somehow, the carbon declare won' not work.

_________________
Working system: Mac OS X 10.6.x
_________________________________
Note : I am not interested in any solutions that need custom Plug-ins of any kind


Top
 Profile  
Reply with quote  
 Post subject: Re: Mouse enter/exit event does not fire on window's bar
PostPosted: Fri Nov 23, 2012 1:06 pm 
Offline
User avatar

Joined: Thu Feb 16, 2006 10:04 pm
Posts: 262
Please give a more descriptive answer of "does not work", what are you seeing? And please give what versions you are using. Works fine for me.

_________________
Thomas C.
Real Studio Blog
http://bigdaddysurf.com/blog/

https://itunes.apple.com/us/app/maui-dragstrip-2013/id604516033?mt=8
https://itunes.apple.com/us/book/how-to-waterstart/id576214730?mt=11


Top
 Profile  
Reply with quote  
 Post subject: Re: Mouse enter/exit event does not fire on window's bar
PostPosted: Fri Nov 23, 2012 1:18 pm 
Offline

Joined: Mon Oct 09, 2006 9:05 am
Posts: 145
Thank you again, mauitom.

I got it work, now. The if statement has to be modified for Carbon. :wink:

Note for others:

• Carbon's screen begins at
Top Left


• Cocoa's screen begins at
Bottom Left

_________________
Working system: Mac OS X 10.6.x
_________________________________
Note : I am not interested in any solutions that need custom Plug-ins of any kind


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

All times are UTC - 5 hours


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:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group