Trouble with mouseMoved and custom views
Trouble with mouseMoved and custom views
- Subject: Trouble with mouseMoved and custom views
- From: Christopher Drum <email@hidden>
- Date: Thu, 23 Dec 2004 09:18:21 -0800
In a previous posting I had asked for help with mouseEntered and mouseExited on a little color palette I was working on. My problem was the order in which mouseEntered and mouseExited are called changes depending upon the direction I move the mouse. The suggestion was to use mouseMoved instead to track the mouse location within my custom view and highlight color palette swatches using the mouse coordinates. (Originally I had a tracking rect for each individual color palette swatch)
This solution has helped me progress, but mouseMoved seems to carry other issues with it.
Perhaps I'm just not groking something here, but as I understand things...
1. My custom view must be the initialFirstResponder for my window (this is a single window app).
2. My main window needs [mainWindow setAcceptsMouseMovedEvents:
YES];
I can move the mouse cursor along my row of color swatches and they will highlight to indicate the currently selected swatch. This all worked just fine for me, until I started typing into an editable text field. However, once I type into a text field, my palette view stops accepting mouseMoved events and I can't figure out how to receive those events again.
My color palette accepts color swatches dragged in from the app's color wells. This drag and drop behavior continues to function perfectly. Dragging a color swatch to the palette correctly highlights the currently selected palette swatch. So, draggingEntered and draggingUpdated don't seem to be affected by having focus on the text field, just mouseMoved.
I thought I might need to manually adjust the current focus upon mouseEntered into my palette view with:
[[NSView focusView] unlockFocus];
[
self lockFocus];
However, this doesn't seem to be working.
So, how do I programatically make the text fields stop accepting mouseMoved events, so that my custom view can receive those events again? Also, how can I remove focus from a selected text field and should I? Seems to me that the user would expect a selected text field to stay selected, even if s/he is playing with the color swatches in a palette.
------------------------------------------------------------------
Christopher Drum
http://homepage.mac.com/christopherdrum
Check out FileWrangler, my five-star rated (MacUpdate, VersionTracker) Cocoa app written in Objective-C for the batch renaming of files.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden