• 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: NSView setHidden vs. setTransparent
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.


  • Follow-Ups:
    • Re: NSView setHidden vs. setTransparent
      • From: Scott Anguish <email@hidden>
References: 
 >NSView setHidden vs. setTransparent (From: "Huyler, Christopher M" <email@hidden>)

  • Prev by Date: Re: Alpha-channeled images fade to black?
  • Next by Date: Re: substring return a new string?
  • Previous by thread: NSView setHidden vs. setTransparent
  • Next by thread: Re: NSView setHidden vs. setTransparent
  • Index(es):
    • Date
    • Thread