Monday, May 7, 2007

Key Press and Mouse Events in Objective-C

Okay, here is another situation that a programmer might have. Lets say, you are creating a drawing application that requires you to click and hold the mouse and drag it around the screen to draw a line. You can change the color by pressing a button on the keyboard, like b for black, r for red, g for green, etc... How would you go about doing that if the standard events in XCode don't allow for this...

This application is coming up next! I'm excited about this one simply because it will provide more control for you application.

2 comments:

johannesnoe said...

Hey, I couldn't find this app on the demo-server. I'm VERY interested in an app that "holds down" the mousebutton for as long as I like, so it would be awesome if you could revive this app!

Regards,
Johannes

ThE uSeFuL said...

I think the following might put you in the correct line of thinking. See how they have implemented,

- (void)mouseDragged:(NSEvent *)theEvent

link: http://www.cocoadev.com/index.pl?BorderlessWindow