The NSButtonCell class is a subclass of NSActionCell used to implement the user interfaces of push buttons, checkboxes (switches), and radio buttons. It can also be used for any other region of a view that’s designed to send a message to a target when clicked. The NSButton subclass of NSControl uses a single NSButtonCell.
Questions tagged [nsbuttoncell]
77 questions
27
votes
7 answers
Simple mouseover effect on NSButton
I am creating a custom NSButtonCell for a custom rendering.
Now, I want to have different aspect depending if the mouse is over the button or not. How can I get this information?
Thanks and regards,

AP.
- 5,205
- 7
- 50
- 94
11
votes
1 answer
NSButtonCell highlighting remains on keypress in Mojave
I have a class derived from NSButtonCell where I draw bezel:
override func drawBezel(withFrame frame: NSRect, in controlView: NSView) {
let path = NSBezierPath(bound: frame.insetBy(dx: CGFloat(config.buttonInset), dy:…

Pablo
- 28,133
- 34
- 125
- 215
10
votes
2 answers
NSButtonCell inside custom NSCell
in my cocoa application, I need a custom NSCell for an NSTableView. This NSCell subclass contains a custom NSButtonCell for handling a click (and two or three NSTextFieldCells for textual contents). You'll find a simplified example of my code…

Tobidobi
- 390
- 2
- 8
9
votes
4 answers
NSButtonCell vs NSButton
I've been reading through the Apple documentation about NSButtons and cells and I really can't seem to understand the distinction between the two. Adding to this complexity, it looks like both of them have a large overlap of methods like setTitle:…

Tejaswi Yerukalapudi
- 8,987
- 12
- 60
- 101
8
votes
4 answers
NSButton white background when clicked
When creating Cocoa bevel button with custom image and alternate image I'm having a strange behavior. In the pressed state the button background becomes white.
I'm adding the button as subview of a transparent window (HUD window).
I'm trying every…

loretoparisi
- 15,724
- 11
- 102
- 146
5
votes
1 answer
NSButtonCell as Checkbox in a NSTableVIew don't get selected
I have a NSTableVIew for multi-selection purposes with two columns, the first one with a NSButtonCell as checkbox and the other one as a title.
The idea is to check the items to be added afterwords to an array.
The problem is that the checkboxes…

Omer
- 5,470
- 8
- 39
- 64
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
4
votes
1 answer
NSButtonCell in NSTableView: click handling
I set NSButtonCell as a cell type in a Table Column in my NSTableView.
I implemented an IBAction method, but I can't wire it with NSButtonCell in IB - the wire don't want to highlight a button from NSTableView.
How to connect a method with…

Ilya Blokh
- 11,923
- 11
- 52
- 84
4
votes
1 answer
How to show button cell (check box) title in table view, using bindings
I am trying a simple application where I have a mutable array of mutable dictionaries, such as -
NSMutableDictionary *sample6 = [[NSMutableDictionary alloc] initWithObjectsAndKeys:@"title6",@"title",[NSNumber numberWithBool:NO],@"state", nil];
In…

Devarshi
- 16,440
- 13
- 72
- 125
4
votes
2 answers
Custom NSButton drawing messes up text rendering
I'm subclassing NSButton / NSButtonCell and everything works fine, but at least in Retina drawing as soon as I implement any of the drawing functions in either NSButton or NSButtonCell, the text rendering changes no matter whether I do some custom…

Frank R.
- 2,328
- 1
- 24
- 44
4
votes
1 answer
create custom button with image in interface builder
How do I create a button with an images for normal & highlighted states in interface builder for cocoa application? I need a button like custom button in cocoa-touch and provide a graphics for default and highlighted states. Again, it's for pure mac…

Nava Carmon
- 4,523
- 3
- 40
- 74
4
votes
2 answers
Problems with NSButtonCell action
For some reason the NSButtonCell for my table view is passing the wrong object as a parameter. I am trying to read the tag of the NSButtonCell after it is clicked.
Here is a simplified version of my code:
- (int)numberOfRowsInTableView:(NSTableView…

Gabriel L
- 43
- 4
3
votes
3 answers
iPhoto like NSButton
How can I create a iPhoto like button like in the picture
I've tried out several things using round textured buttons or setting the button's image as template. But none of these approaches really works.
Thanks so far for your answers.
EDIT:
The…

burki
- 2,946
- 6
- 37
- 51
3
votes
1 answer
How to create a NSTextFieldCell, that in edit mode displays a custom view instead of NSTextField?
I have a tableView, with 3 columns containing NSTextFieldCell. Everything is populated with bindings.
The text of the cells of one of the column is computed and is not editable directly.
For this column, I would like when the cell goes into edit…

Guillaume
- 21,685
- 6
- 63
- 95
3
votes
1 answer
NSButton in Swift, handle click and release events
i'm trying to manage different state of a simple push button on an OS X application : When the user click on it, and when the user release the click.
Currently i set my button type by NSMomentaryLightButton
NSMomentaryLightButton When the button is…

Kyz
- 141
- 9