Hi Agha,
I guess you've overridden your NSViewController's loadView method, which seems
like a good place to roll your own button.
You'll need to create and initialize the button with something like this:
NSButton *newButton = [[[NSButton alloc] initWithFrame:nestedFrame]
autorelease];
And then you have to diddle with the button's instance variables.
These might include – but are not limited to – things like:
[newButton setButtonType:NSSwitchButton];
[[newButton cell] setEnabled:YES];
[newButton setTransparent:NO];
[newButton setBordered:NO];
[newButton setBezelStyle:NSShadowlessSquareBezelStyle];
[newButton setTitle:@""];
There are enough permutations of these that you'll probably have to experiment
some to determine which properties (instance method settings) are pertinent to
your case. (I've found that AppKido most useful for this.)
If you want to hook the button into the responder chain, you'll need to do
something like this:
[[newButton cell] setRefusesFirstResponder:NO]; // accept first responder.
[[newButton cell] setShowsFirstResponder:YES]; // show first responder.
And you'll need an action method, that IB would have let you connect
graphically, but you'll set up like this:
[self setAction:@selector(buttonClicked:)];
If you're subclassing NSButton, the recipe is slightly more complicated. But
you're doing the same stuff, in the context of an NSButton subclass.
HTH,
Joel
_______________________________________________
Cocoa-dev mailing list ([email protected])
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [email protected]