Code:- (void) keyDown:(NSEvent *)theEvent { }
is not responding.Can anyone tell me the reason?
- (void) readBinjusMind (NSEvent *) theEvent
{
}
-(BOOL)acceptsFirstResponder
{
[[self window] makeFirstResponder:self];
return YES;
}
// KitplayerAppDelegate.m
#import "KitplayerAppDelegate.h"
#import "QTKit/QTKit.h"
#import "QuickTime/Movies.h"
#import "Appkit/NSResponder.h"
@implementation KitplayerAppDelegate
@synthesize window;
static const unichar kESCKey = 27;
-(BOOL)acceptsFirstResponder
{
NSLog(@"First responder");
[[mMovieView window] makeFirstResponder:mMovieView];
return YES;
}
- (void)keyDown:(NSEvent *)event
{
NSLog(@"key down");
unichar keyPressed = [[event charactersIgnoringModifiers] characterAtIndex:0];
if( keyPressed == kESCKey )
{
if( [mMovieView isInFullScreenMode] )
{
[mMovieView exitFullScreenModeWithOptions:fullScreenOptions];
}
}
}
I placed a quick time movie view (mMovieView)in my window. While the movie is playing in full screen mode, I want to exit the fullscreen mode by pressing esc key .
@interface KitplayerAppDelegate : [COLOR="Blue"]NSResponder[/COLOR] { ...
I believe that is not strictly true. If you look at NSView, it has no methods for interacting with the NSEvent, the event methods derive from NSView's first superclass, NSResponder. Hence, I believe it could be possible to make the Application delegate handle keystrokes simply by making it a subclass of NSResponder.
Try changing the line in the interface file to
Code:@interface KitplayerAppDelegate : [COLOR="Blue"]NSResponder[/COLOR] { ...
It is not really proper Cocoa form to do that, but I think it would work. If your application might have more than one window open, however, it would be better to subclass the movie view.
Now, as I read his posting history, he'll not acknowledge the assistance provided, but will start another thread shortly with another problem.
I believe that is not strictly true. If you look at NSView, it has no methods for interacting with the NSEvent, the event methods derive from NSView's first superclass, NSResponder. Hence, I believe it could be possible to make the Application delegate handle keystrokes simply by making it a subclass of NSResponder.
Try changing the line in the interface file to
Code:@interface KitplayerAppDelegate : [COLOR="Blue"]NSResponder[/COLOR] { ...
It is not really proper Cocoa form to do that, but I think it would work. If your application might have more than one window open, however, it would be better to subclass the movie view.
No luck ya
NSResponder *currentNextResponder = [NSApp nextResponder];
[NSApp setNextResponder:self];
[self setNextResponder:currentNextResponder];
I didn't bother re-reading this thread, but ...
I don't believe your application delegate inherits the NSResponder protocol thus the error, or warning (depending on flag to the compiler).