nsbuttoncell

NSButtonCell in NSTableView: click handling

不想你离开。 提交于 2019-12-05 16:37:06
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 NSButtonCell ? Or maybe there'se another way to handle its click event? Thanks You should be able to wire up a connection from the cell by control+dragging to any object in your NIB. Just make sure the cell is actually selected, and that your action is defined as an IBAction in the object's header file. In your action method you can determine which row was

How to create a NSTextFieldCell, that in edit mode displays a custom view instead of NSTextField?

╄→尐↘猪︶ㄣ 提交于 2019-12-04 17:28:32
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 mode , to display a button or a custom view instead of the textField . Said in an other way, I want an NSCell that is a NSTextFieldCell when not being edited, and a NSButtonCell (or a custom view) when being edited. Any hint to move on to this? Here is what I tried, without success: Try #1 : I subclassed a NSTextFieldCell and override

NSButton white background when clicked

て烟熏妆下的殇ゞ 提交于 2019-12-04 12:07:26
问题 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 technique that I know: NSButton *closeButton = [[NSButton alloc] initWithFrame:NSMakeRect(0.0, 0.0, 30.0, 30.0)]; [closeButton setFrameOrigin:NSMakePoint(0.0, 0.0)]; [closeButton setImagePosition:NSImageOnly]; [closeButton setAction:@selector

Simple mouseover effect on NSButton

拥有回忆 提交于 2019-12-03 08:42:48
问题 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, 回答1: Here is i have created and worked for me perfectly... Step 1: Create the Button with tracking area NSButton *myButton = [[NSButton alloc] initWithFrame:NSMakeRect(100, 7, 100, 50)]; [myButton setTitle:@"sample"]; [self.window.contentView addSubview:myButton]; // Insert code here to initialize

Simple mouseover effect on NSButton

二次信任 提交于 2019-12-02 22:39:37
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, Here is i have created and worked for me perfectly... Step 1: Create the Button with tracking area NSButton *myButton = [[NSButton alloc] initWithFrame:NSMakeRect(100, 7, 100, 50)]; [myButton setTitle:@"sample"]; [self.window.contentView addSubview:myButton]; // Insert code here to initialize your application NSTrackingArea* trackingArea = [[NSTrackingArea alloc] initWithRect:[myButton bounds]

NSButtonCell inside custom NSCell

不羁的心 提交于 2019-11-28 18:28:35
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 below. @implementation TheCustomCell - (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView { // various NSTextFieldCells NSTextFieldCell *titleCell = [[NSTextFieldCell alloc] init]; .... // my custom NSButtonCell MyButtonCell *warningCell = [[MyButtonCell alloc] init]; [warningCell setTarget:self]; [warningCell setAction:@selector

NSButtonCell inside custom NSCell

半腔热情 提交于 2019-11-27 11:22:46
问题 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 below. @implementation TheCustomCell - (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView { // various NSTextFieldCells NSTextFieldCell *titleCell = [[NSTextFieldCell alloc] init]; .... // my custom NSButtonCell MyButtonCell *warningCell