cursor handling
cursor handling
- Subject: cursor handling
- From: David Harper <email@hidden>
- Date: Fri, 6 Jul 2007 11:42:58 -0400 (EDT)
Hello,
I am now implementing custom cursor handling in my application. I have set a subclass of view (which is used as a subview in my firstresponder view) to be the owner of a tracking rect (in this case, the entire view frame).
The view is a custom text field that can either be edited or dragged around, so I've inititialized in the subview 4 cursors, an openhand, closedhand, ibeam and arrow (I'm not sure if I should be doing this, nor do I know how the PUSH and POP mechanism works since there appears to be no global cursor variable to manipulate). mouseEntered and mouseExited respond flawlessly, for example using [myArrowCursor set] to return to a normal cursor when exiting the subview, and turning to either an openhand or ibeam cursor when entering.
There are a few problems, however.
1. when the subview is initially created, if the cursor is already inside the subview it is not changed to an ibeam cursor. Even if I manually use [myIBeamCursor set] after initialization it is automatically reverted to an arrow after what appears to be a single screen refresh (regardless of mouse movement). I am not using cursor rectangles in the subview because the cursor rectangle contains the entire view and i think mouseEntered and mouseExited responses are sufficient to get the information necessary. Should I be trying to implement a mouseMoved responder? I don't think this is necessary but I'm not sure what to do.
2. pressing enter disables the isBeingEdited BOOL and allows the user to move the text box around. When enter is pressed I check the mouse coordinate and if it is within the subview I invoke [myOpenHandCursor set]. This also doesn't work. However, moving the mouse outside the subview then back in works fine.
Otherwise, it's all working properly. Any suggestions are greatly appreciated.
-Dave H.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden