• 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: Changing cursor holding down the ALT key
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Changing cursor holding down the ALT key


  • Subject: Re: Changing cursor holding down the ALT key
  • From: Andreas Mayer <email@hidden>
  • Date: Thu, 4 Sep 2003 02:51:58 +0200

Am Mittwoch, 03.09.03 um 22:43 Uhr schrieb Lorenzo:

I would like now to change the cursor when the ALT key is holding down.
I tried keyDown: but it doesn't notify the ALT is pressed until a charatecr
is pressed too.

#import <AppKit/AppKit.h>

@interface TestWindow : NSWindow {}
@end


#import "TestWindow.h"

@implementation TestWindow

- (void)sendEvent:(NSEvent *)theEvent
{
if ([theEvent type] == NSFlagsChanged) {
[NSApp sendAction:@selector(myFlagsChanged:) to:nil from:theEvent];
}
[super sendEvent:theEvent];
}

@end


And somewhere in the responder chain:

- (void)myFlagsChanged:(NSEvent *)theEvent
{
NSLog(@"tick");
if ([theEvent modifierFlags] & NSAlternateKeyMask) {
// alt pressed
[[NSCursor IBeamCursor] set];
} else {
// alt not pressed
[[NSCursor arrowCursor] set];
}
}


Thanks for the question. This could come in handy some day. ;-)


bye. Andreas.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Changing cursor holding down the ALT key (From: Lorenzo <email@hidden>)

  • Prev by Date: Re: Hiding an NSControl
  • Next by Date: Re: Hiding an NSControl
  • Previous by thread: Changing cursor holding down the ALT key
  • Next by thread: [ANN] Docoa Browser 0.1
  • Index(es):
    • Date
    • Thread