• 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: Sort of OT: Closing Carbon-based view windows with the menu
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Sort of OT: Closing Carbon-based view windows with the menu


  • Subject: Re: Sort of OT: Closing Carbon-based view windows with the menu
  • From: m <email@hidden>
  • Date: Fri, 4 Mar 2005 13:41:41 -0800

On Mar 4, 2005, at 12:41 PM, Robert Grant wrote:

A user just brought to my attention that Apple+W is not closing the AU editor windows. Testing with Cocoa and Carbon AU views shows that it's Carbon windows that are causing trouble. The Carbon in Cocoa docs imply that there's nothing to do to support it and sure enough the sample app happily closes the Cocoa'ized Carbon window. But in Rax I just get an annoying beep. So it looks like the Responder chain is buggered somewhere along the line.

Hi Robert,

I thought I had written to you about this a few months ago. I had wrestled with the same thing and concluded it was "just broke". Here's how I worked around it.

In your window's delegate:

- (IBAction) closeWindow:(id)sender
{
	NSWindow* keyWindow = [NSApp keyWindow];

	if ([[keyWindow class]isSubclassOfClass:[NSCarbonWindow class]])
	{
		[keyWindow close];
	}
	else
	{
		[keyWindow performClose:sender];
	}
}

By the way, many AU hosts also have a problem where clicking in the content area of an inactive AU window won't activate it. Here's a fix (in a subclass of NSApplication):

- (void)sendEvent:(NSEvent *)anEvent
{
	if (	[anEvent type] == NSLeftMouseDown &&
			!([anEvent modifierFlags] & NSCommandKeyMask) &&
			[[anEvent window] isKindOfClass:[NSCarbonWindow class]])
	{
		[[anEvent window] makeKeyAndOrderFront:self];
	}

	[super sendEvent:anEvent];
}

_murat

_______________________________________________
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


  • Follow-Ups:
    • Re: Sort of OT: Closing Carbon-based view windows with the menu
      • From: m <email@hidden>
  • Prev by Date: Re: Detecting the Option key at launch
  • Next by Date: Re: Sort of OT: Closing Carbon-based view windows with the menu
  • Previous by thread: Re: Detecting the Option key at launch
  • Next by thread: Re: Sort of OT: Closing Carbon-based view windows with the menu
  • Index(es):
    • Date
    • Thread