Screen MousePosition Cocoa mouseLocation
Screen MousePosition Cocoa mouseLocation
Can some one show me how to use the cocoa mouseLocation command to get the mouse position on screen?
macOS Catalina 10.15.7
Re: Screen MousePosition Cocoa mouseLocation
Code: Select all
Location.NSPoint
CocoaMessage(@Location, 0, "NSEvent mouseLocation")
Debug Location\x
Debug Location\y
Windows (x64)
Raspberry Pi OS (Arm64)
Raspberry Pi OS (Arm64)
Re: Screen MousePosition Cocoa mouseLocation
Thanks Wilbert!wilbert wrote:Be aware that on OS X, not the top left but the bottom left location is (0, 0) .Code: Select all
Location.NSPoint CocoaMessage(@Location, 0, "NSEvent mouseLocation") Debug Location\x Debug Location\y
But how do I know that class func mouseLocation() -> NSPoint musst be written as "NSEvent mouseLocation" ?
macOS Catalina 10.15.7
Re: Screen MousePosition Cocoa mouseLocation
Just take a look at the cocoa classes once in a whileWolfram wrote:how do I know that class func mouseLocation() -> NSPoint musst be written as "NSEvent mouseLocation" ?

If you look at the NSEvent Class Reference you see it marked with a (+) indicating that it's a class function that doesn't require to create an instance first.
A lot of other methods are instance methods marked with a (-) that need a class instance to work on.
Windows (x64)
Raspberry Pi OS (Arm64)
Raspberry Pi OS (Arm64)
Re: Screen MousePosition Cocoa mouseLocation
where are these lessons?Just take a look at the cocoa classes once in a while
Re: Screen MousePosition Cocoa mouseLocation
What mean with [+] [-] ?
Link: https://developer.apple.com/documentati ... guage=objc
If I don't know which methods there are or the description is not quite right, I display the methods of an object.
Link: Dump Object Methods
Link: https://developer.apple.com/documentati ... guage=objc
If I don't know which methods there are or the description is not quite right, I display the methods of an object.
Link: Dump Object Methods
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive