• 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: How to create and show an NSButton programmatically?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to create and show an NSButton programmatically?


  • Subject: Re: How to create and show an NSButton programmatically?
  • From: Scott Anguish <email@hidden>
  • Date: Sun, 5 Feb 2006 17:49:52 -0500

initWithFrame: is the designated initializer for NSButton.

Basically, you're not saying where you want the button to be placed in the superview (contentView)


On Feb 5, 2006, at 5:30 PM, Ivan Kourtev wrote:

Hello,

I am having trouble creating and showing a button (instance of NSButton) on a window programmatically? I have tried allocating and initializing the button with something along the lines of:

NSButton *button = [[NSButton alloc] init];
[button setButtonType:NSMomentaryPushInButton];
[[newWindow contentView] addSubview:button];
[button setNeedsDisplay:YES];

and although I get no errors or warnings (at compile or run time) I am not able to make the button show up.

I searched the documentation and it doesn't speak much of doing what I am doing so perhaps this is not the preferred way of doing what I want to do? What am I missing here?

Thanks for any help,

--
ivan
_______________________________________________
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

_______________________________________________ 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: How to create and show an NSButton programmatically?
      • From: Ivan Kourtev <email@hidden>
References: 
 >How to create and show an NSButton programmatically? (From: Ivan Kourtev <email@hidden>)

  • Prev by Date: Re: Universal Binaries and messages to nil
  • Next by Date: Migrating X11-based library to Cocoa
  • Previous by thread: How to create and show an NSButton programmatically?
  • Next by thread: Re: How to create and show an NSButton programmatically?
  • Index(es):
    • Date
    • Thread