MAAttachedWindow hide

Posted by Montecorte on Stack Overflow See other posts from Stack Overflow or by Montecorte
Published on 2012-03-22T17:24:48Z Indexed on 2012/03/22 17:30 UTC
Read the original article Hit count: 249

Filed under:
|
|
|

I had the same problem that The-Kenny at this post but I fixed it adding the windowDidResignKey: method on the MAAttachedWindow.m, but now my problem is that when I click outside the StatusBar item keeps blue background and when I click another time on the status item it goes normally and I have to click a second time on it to show the window. I tried to add a method in the CustomView (the view of the status item) that do the same thing that te mouseDown method:

- (void)mouseDown:(NSEvent *)event {
NSRect frame = [[self window] frame];
NSPoint pt = NSMakePoint(NSMidX(frame), NSMidY(frame));
NSLog(@"%g,%g",pt.x,pt.y);
clicked = !clicked;
[controller toggleAttachedWindowAtPoint:pt];
[self setNeedsDisplay:YES];}

my method is:

- (void)windowDidResignKey {
NSLog(@"Resigned");
NSRect frame = [[self window] frame];
NSPoint pt = NSMakePoint(NSMidX(frame), NSMidY(frame));
NSLog(@"%g,%g",pt.x,pt.y);
clicked = !clicked;
[controller toggleAttachedWindowAtPoint:pt];
[self setNeedsDisplay:YES];}

I call this method in the windowDidResignKey that I have defined on MAAttachedWindow.m, but this method dont call correctly the toggleAttachedWindowAtPoint method, I dont know exactly why, it's only called when I click another time over the status item

If anybody knows how to do that any help would be fine.

Thank you so much :)

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about xcode