Re: Problem with disclosure triangle (resizing Cocoa view) in Logic
Re: Problem with disclosure triangle (resizing Cocoa view) in Logic
- Subject: Re: Problem with disclosure triangle (resizing Cocoa view) in Logic
- From: Michael Hopkins <email@hidden>
- Date: Mon, 22 Aug 2005 11:06:49 -0700
Christian,
It's a bad idea for you to be resizing the window from your audio
unit. Your audio unit does not own the window, the host does, and you
should not change its size behind its back. The fact that it works in
AU Lab means that you are getting lucky. Please don't do this or rely
on that behavior.
That being said, we will look into the feasibility of a mechanism
whereby a view can request a new view size from the host. Remember it
will still be up to the host to determine whether it wants to honor
the request.
-Michael
On Aug 22, 2005, at 8:35 AM, christian wrote:
I've created a Cocoa view for my AU plugin, and it contains some
non-critical controls that are in a disclosable "expert" section,
similar to those in the AU Lab General Preferences pane.
The attached code works and looks good in AU LAb, but in Logic
(latest) the entire view is shifted up and out of the window's view.
Can someone point out what I've done wrong with this code? Or,
suggest a better way of doing this? I guess it's causing a problem
that I'm subtracting from the y origin; but why does it work in AU
Lab? I'm fairly inexperienced at Cocoa programming, so some of
this was written as a stab in the dim light.
The UI is panted in IB with all of the "export" controls laid out
in an NSBox (bound to member field "uiExtraControls") with the
"hidden" box checked in the Attributes Inspector. The method
iaToggleExtraControls is bound to the disclosure triangle button.
All of the controls in the main view have "springy" connections
(Size Inspector) to the bottom of the main view.
Thanks,
christian
- (void) awakeFromNib
{
NSRect rect;
float windowDelta = 0;
rect = [uiExtraControls frame];
windowDelta = rect.size.height;
rect = [self frame];
rect.size.height -= windowDelta;
rect.origin.y -= windowDelta;
[self setAutoresizingMask:NSViewMinYMargin];
[self setFrameSize:rect.size];
}
- (IBAction)iaToggleExtraControls:(id)sender
{
NSWindow * window = [self window];
NSRect rect;
float windowDelta = 0;
rect = [uiExtraControls frame];
windowDelta = rect.size.height;
bool isHidden = [uiExtraControls isHidden];
if (! isHidden)
{
windowDelta *= -1;
}
// resize the view size
rect = [self frame];
rect.size.height += windowDelta;
[self setAutoresizingMask:NSViewMinYMargin];
[self setFrameSize:rect.size];
// resize the window
rect = [window frame];
rect.size.height += windowDelta;
rect.origin.y -= windowDelta;
[window setFrame:rect display:YES animate:YES];
[uiExtraControls setHidden:(!isHidden)];
}
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40apple.com
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden