Questions tagged [nsbutton]

The NSButton class is a subclass of NSControl that intercepts mouse-down events and sends an action message to a target object when it’s clicked or pressed.

535 questions
5
votes
1 answer

NSButton with two or more actions

I am iOS developer and I want to develop a Mac app (it's basically a "port" from an iOS app). In IB in iOS is very easy to connect one UIButton to two or more actions. I have noticed that in a Mac App I only can connect a NSButton to a single…
5
votes
1 answer

NSButton does not show alternative Title since SDK update?

Background Information: I've recently upgraded from Lion to MountainLion and the newest xCode. The app im working on has deployment target 10.7. Problem: I've a NSButton setup in the Interfacebuilder with Title: "Start" and Alternate: "Stop". In the…
Git.Coach
  • 3,032
  • 2
  • 37
  • 54
5
votes
1 answer

imageRectForBounds not called in NSButtonCell subclass

I needed to create a NSButton with both image and title but I didn't like any of the standard positioning methods in cocoa. I decided to subclass the button cell and override the -imageRectForBounds: and -titleRectForBounds: to provide my custom…
Jacopo
  • 1,031
  • 2
  • 12
  • 25
5
votes
3 answers

How to change the background color of an NSPopupButton?

I am trying to tackle a problem which sounds pretty simple: changing the background color of an NSPopupButton. Interface Builder only allows changing the style to a pre-defined one and doesn't allow changing the background color. Also, setting up…
Aamir
  • 5,324
  • 2
  • 30
  • 47
4
votes
2 answers

NSButton in NSTableCellView: How to find desired objectValue?

I have a view-based NSTableView that is populated through bindings. My textFields & imageViews are bound to the NSTableCellView's objectValue's properties. If I want to have an edit/info button in my NSTableCellView: Who should be the target of…
4
votes
2 answers

NSButton gradient style

In Interface Builder components I have Gradient Button I would like to create this button programmatically. But I can't find combination of button type, bezel style and gradient type to reproduce it. My local goal is to create plus (add) and minus…
alexchernyy
  • 1,216
  • 10
  • 12
4
votes
2 answers

How can i create `IBOutlet` or `IBAction` in custom class

how can i create IBOutlet or IBAction taking into account following conditions: IBAction or IBOutlet must be created inside my custom class (inherited from NSObject) NSButton instance is visible inside Interface Builder (XCode 4) In short i would…
xyz
  • 2,277
  • 2
  • 25
  • 41
4
votes
1 answer

Click a NSPushButton programmatically with "animation"

I just ran into a problem I already know from other programming languages/frameworks .... Whenever the user clicks a certain button on the keyboard, he triggers the same action than when a certain button in the GUI is pressed. ( Some guys call these…
guitarflow
  • 2,930
  • 25
  • 38
4
votes
2 answers

How do I prevent an NSButton from registering presses while disabled?

Newbie Warning I have a simple but vexing problem trying to disable an NSButton. Here is sample code to illustrate the problem: - (IBAction)taskTriggeredByNSButtonPress:(id)sender { [ibOutletToNSButton setEnabled:NO]; //A task is performed here that…
scolfax
  • 710
  • 2
  • 6
  • 17
4
votes
3 answers

How do you vertically centering an image on an NSButton

I'm build a Mac application in the style of the Lion Mail.app. As part of this I'm attempting to create a simular toolbar to the one in the Mail.app but I can't seem to get the image in my toolbar button centered vertically. Looking at the Mail.app…
Ayal
  • 440
  • 1
  • 5
  • 15
4
votes
3 answers

Make NSButton a Hyperlink in Cocoa

I was wondering how to make an NSButton a hyperlink so it opens an external webpage in the user's default browser. Thanks in advance!
user437038
4
votes
3 answers

mouseEntered event disabled when mouseDown (NSEvents Mac)

I have created an NSButton class, and when rolling over my buttons it happily detects mouseEntered and mouseExited events. But as soon as the mouseDown event occurs, so long as the mouse it down, mouseEntered events are no longer called until the…
Josh Kahane
  • 16,765
  • 45
  • 140
  • 253
4
votes
0 answers

How do I override the mouseDragged() function for NSButton on MacOS?

I have a MacOS app which uses NSButton objects. The button is set to style "Push" and type "Push On Off". I have created a class called DraggableButton which attempts to override the function: override func mouseDragged(event: NSEvent){ …
dmann200
  • 529
  • 4
  • 11
4
votes
1 answer

Add a close button to NSTabviewitem

I have a application with a tab view when the user clicks in the menu for example "client data" I generate a tab programmaticaly. Now I want to subclass the tab view to add a close button for each NSTabviewitem. If you don't have an answer you could…
Javier Beltrán
  • 756
  • 5
  • 26
4
votes
1 answer

How to scale axes independently at runtime on an NSButton

In Interface Builder, you can select how you want a button's image to be scaled, choosing either Axes Independent, Proportionally Down, etc. for the "Scaling" drop-down. How can I access or change this attribute of the NSButton at runtime?
Regan
  • 1,487
  • 2
  • 28
  • 43