Re: Child Windows and Mouse Events
Re: Child Windows and Mouse Events
- Subject: Re: Child Windows and Mouse Events
- From: Greg <email@hidden>
- Date: Tue, 15 Feb 2005 11:15:29 +1000
Yes, i'm the delegate. It is an NSWindow subclass. Still not getting
called.
@implementation PImageViewerWindow
- (id)init
{
[super initWithContentRect:NSZeroRect
styleMask:NSTexturedBackgroundWindowMask | NSBorderlessWindowMask
backing:NSBackingStoreRetained
defer:YES];
[self setAlphaValue:1.0];
[self setOpaque:YES];
[self setHasShadow:YES];
[self setLevel:NSStatusWindowLevel];
[self setHidesOnDeactivate:YES];
[self setIgnoresMouseEvents:NO];
[self setReleasedWhenClosed:YES];
PImageViewerImageView *imgView = [[PImageViewerImageView alloc]
initWithFrame:NSZeroRect];
[imgView setEditable:NO];
[imgView setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
[imgView setImageScaling:NSScaleProportionally];
[self setContentView:imgView];
[self setFrame:[self frameRectForContentRect:[imgView frame]]
display:NO];
[imgView release];
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
[nc addObserver:self
selector:@selector(windowDidResignKey:)
name:NSWindowDidResignKeyNotification
object:self];
[nc addObserver:self
selector:@selector(windowDidResignMain:)
name:NSWindowDidResignMainNotification
object:self];
[self setDelegate:self];
return self;
}
- (void)viewImage:(NSImage *)image withFrame:(NSRect)frame
{
[(PImageViewerImageView *)[self contentView] setImage:image];
[self setFrame:frame display:YES];
[self makeKeyAndOrderFront:self];
}
- (void)closeMe
{
[[self parentWindow] removeChildWindow:self];
[self orderOut:self];
}
- (void)mouseDown:(NSEvent *)theEvent
{
NSLog(@"mouse");
[self closeMe];
}
- (void)windowDidResignKey:(NSNotification *)aNotification
{
NSLog(@"resigning key");
[self closeMe];
}
- (void)windowDidResignMain:(NSNotification *)aNotification
{
NSLog(@"resigning main");
[self closeMe];
}
@end
On 15/02/2005, at 10:08 AM, j o a r wrote:
On 2005-02-15, at 01.04, Greg wrote:
That's correct. They don't get called. Does it have something to do
with being a child window?
Don't know. Are you sure you're the delegate of the window? Have you
tried signing up for the notifications, instead of relying on the
delegate methods?
j o a r
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden