Re: NSView setHidden vs. setTransparent
Re: NSView setHidden vs. setTransparent
- Subject: Re: NSView setHidden vs. setTransparent
- From: Daniel Todd Currie <email@hidden>
- Date: Thu, 18 Mar 2004 15:39:32 -0800
I can't really comment on whether or not setting the button to
transparent and disabling it is really equivalent to setting it to
hidden, but I've always been told that working with superviews/subviews
is the best way to do what you need. My recommendation for 10.2
support is as follows:
Set up some of the objects we will be working with:
- (void)awakeFromNib
{
...
[myButton retain];
NSView *buttonSuperview = [myButton superview];
...
}
Then to hide, use:
if([myButton superview]) [myButton removeFromSuperview];
And to show, use:
if(![myButton superview]) [buttonSuperview addSubview:myButton];
You need to increase the retain count of myButton in awakeFromNib,
since -removeFromSuperview: will drop the retain count. Therefore, be
sure to release myButton on quit.
Hope this helps.
-- Daniel Currie
On 2004 Mar 18, at 13:56, Huyler, Christopher M wrote:
I have been working on a small application on my 10.3.2 machine with
Xcode and only realized now that "setHidden" is not supported in 10.2.
My quick question is, are these two examples equivalent?
Example #1:
[myButton setHidden:YES];
Example #2:
[myButton setTransparent:YES];
[myButton setEnabled:NO];
My initial tests say that they are, but I want to be sure.
Thanks in advance.
--
Christopher Huyler
Computer Associates Intl.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.