nsevent

Device Information from NSEvent/CGEvent

My application uses an event tap to capture keyboard events, and I'd like to know which device (i.e. which keyboard) each event comes from. Is there an sort of device-identifying information along with the CGEvent that a tap gets? I've looked at NSEvent's methods, and the various CGEventField keys, but none of them seem to be device-uniq...

Click-through buttons and not raising the window

The iTunes mini-player (to give just one example) supports click-through where the application isn't brought to the front when the play/pause and volume controls are used. How is this done? I've been looking through Apple's documentation and have a little to go on, in Cocoa Event-Handling Guide, Event Dispatch it states: Some even...

keyUp event heard?: Overridden NSView method

UPDATED: I'm now overriding the NSView keyUp method from a NSView subclass set to first responder like below, but am still not seeing evidence that it is being called. @implementation svsView - (BOOL)acceptsFirstResponder { return YES; } - (void)keyUp:(NSEvent *)event { //--do key up stuff-- NSLog(@"key up'd!"); } @end --OR...

Cocoa's NSView getting insane mouseDown events ?

Hullo all - I've got a NSView subclass that I move programmatically on mouseDown. Which works, but has an odd side effect: I click the subview. The subview moves away [GOOD] I wait a while. I do not move my mouse. Since the subview has moved it's no longer under my cursor. I click my mouse again. I expect the underlying window to get ...

How to store (and use) the current mouse position?

What is the best way to store the current mouse position (system-wide) and then (later) put the mouse at that stored point? [NSEvent mouseLocation] gets me the position, and I can move the mouse with a CGEventMouseMoved, but they each use a different co-ordinates system (I believe y=0 is the top for NSEvent and the bottom for a CGEvent)...

Right-click on a NSStatusItem

Hi. I have a NSStatusItem and I want to popup a menu by rightclicking the item. I subclassed a NSView and overwrote the - (void)rightMouseDown:(NSEvent *)event method. I also implemented - (void)mouseDown:(NSEvent *)event for looking at the modifierflags. My problem is, that the view does not recieve the NSRightMouseDown-Event. And I don...

Keeping window of another application active while still receiving mouse events from another app's window?

Is there a way to have my app's window receive keyboard and/or mouse events (i.e. user clicking on window's buttons) while still retaining focus to another, unrelated app? I've tried configuring my window at different levels, including [myWindow setLevel:NSPopUpMenuWindowLevel] to no avail. ...

NSButton Mousedown event

Hi, I'm trying to show a pop up menu on mouse down on a button. The button should appear pressed while mouse down, and be "un pressed" on mouse up regardless of any of the menu item been selected. Similar to the Expose/Space Preference panel "+" button for adding application. So far I tried 3 methods: Sent action when button is clic...

NSEvent modifier flags not updating until mouse moves.

In Mac OS X 10.6, NSEvent has a +modifierFlags class method to determind the currently pressed modifier flags. In 10.5, using [[NSApp currentEvent] modifierFlags] only updates after mouse move. Is there any way to asynchronously get the modifier flags? ...

Capture key press events while NSMenu is open

Hi, I'm interested in capturing key presses while a NSMenu is open. For example, if the menu is open and the user presses "e", or "1" on the keyboard, send a particular message (preferably passing an event object which contains reference to which key was pressed). I've looked into alternate menus, but I'm under the impression that can ...

NSEvent feeding to system

Can someone show an example on how to create an NSEvent that simulates pressing return? ...

Send a MouseEvent to a NSView (WebView) from code

Hi Cocoa Developers, i am trying to send mouseevent (MouseClick or RightMouseClick) to a NSView... in my case a WebView, that contains a loaded Website. I want to script some clicks on links etc. How is it possible to create a NSEvent and send it to the WebView to perform clicks? Thanks a lot ksman ...