• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Command-Key modified cursor
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Command-Key modified cursor


  • Subject: Re: Command-Key modified cursor
  • From: John Nairn <email@hidden>
  • Date: Mon, 7 Jan 2008 11:55:47 -0800

On Jan 7, 2008, at 8:41 AM, Benjamin Stiglitz wrote:

I implemented tracking rects and used mouseMove to change the cursor depending on modifier keys. In this case holding command key is zoom in while command and option is zoom out. It works OK, but pressing the command key does not get the correct curser until the mouse physically moves again. I tried to find an event for key press, but could not find one (command key or option key alone do not generate keyDown event). I didn't try cursor rects, but found no indication that cursor tracking would update correctly on command or option key presses.

Check out -[NSResponder flagsChanged:].

-Ben

Thanks Ben,

That handles most of the issue, but since flagsChanged only responds to changes, I had to handle special cases where the zoom cursor should change even when the modifier flags have not changed (e.g., when mouse enters or exits the zoom region, when the window becomes or loses key, and also after doing a zoom (because that redisplay also reset the cursor)).

One remaining issue is when window becomes key after losing key status. I need to reset the cursor using the current state of the modifier flags. I was hoping to find an NSEvent class method for those flags (e.g. [NSEvent currentModifierFlags]) that would provide the same function as [NSEvent mouseLocation], which returns the mouse location at any time (i.e., not needing an event to occur), but could not find one? Maybe a carbon call could work here?

---------------
John Nairn (1-541-737-4265, FAX:1-541-737-3385)
Professor and Richardson Chair
Web Page: http://woodscience.oregonstate.edu/faculty/Nairn
FEA/MPM Web Page: http://oregonstate.edu/~nairnj



_______________________________________________

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


  • Follow-Ups:
    • Re: Command-Key modified cursor
      • From: Allen Smith <email@hidden>
References: 
 >Command-Key modified cursor (From: John Nairn <email@hidden>)
 >Re: Command-Key modified cursor (From: Benjamin Stiglitz <email@hidden>)

  • Prev by Date: Re: CALayer Border, Not Inset
  • Next by Date: [Meeting] Toronto CocoHeads / tacow meeting tomorrow
  • Previous by thread: Re: Command-Key modified cursor
  • Next by thread: Re: Command-Key modified cursor
  • Index(es):
    • Date
    • Thread