nsbutton

Looking for a cocoa method to simulate a button press that does not have an Event as a paramter

I need to simulate a button press on my Cocoa button programatically and I am trying to do this on cocotron which unfortunately does not have the NSEvent method: mouseEventWithType:location:modifierFlags:timestamp:windowNumber:context:eventNumber:clickCount:pressure: implemented. Is there anyway to programatically simulate a button pre...

Programatically Removing a Button from a Window in Cocoa OSX

I need to programatically remove a button from a window in Cocoa but the only method close to this was dealloc in NSObject, but this is not what I want to do. Is there a way to actually delete the button from the window not just deallocate its memory? ...

NSShadow with a NSButton subclass

Here's My Code: - (void)drawRect:(NSRect)dirtyRect { // Drawing code here. // Create the Gradient NSGradient *fillGradient = nil; if (mouseIsDown) fillGradient = [[NSGradient alloc] initWithStartingColor:[NSColor colorWithCalibratedRed:0.868 green:0.873 blue:0.868 alpha:1.000] endingColor:[NSColor colorWithCali...

Using an NSButtonCell with template image in a NSTableView

In Interface Builder, I have set the dataCell of one of the columns of my NSTableView instance to be NSButtonCell. This works as expected, however, trying to use a ‘template’ image doesn't yield the expected visual result when clicking the button. How I configure the NSButtonCell: Image: NSRevealFreestandingTemplate Scaling: None Beze...

Making an NSButton resize its image (Cocoa OSX)

I could not find a way in the documentation to tell an NSButton to resize its image to fill up the whole button. Is there a way to do this programatically? ...

How to set NSToggleButton to start in state 0 from Interface Builder?

How can I in Interface Builder set NSButton of type toggle with Title and Alt.Title to start with the Title (e.g. the state 0)? The moment I set the button as toggle and set the Alt.Title it displays Alt.Title in View and I can't find the option to set it to start in the 'default' state (state 0). I could set it pragmatically but is th...

How to make a Cocoa Disclosure Triangle

I have most of the code that works [self.disclosureButton setBezelStyle:NSDisclosureBezelStyle]; [self.disclosureButton setButtonType: NSPushOnPushOffButton]; [self.disclosureButton setTitle:nil]; [self.disclosureButton highlight:NO]; However, when I press the button, it turns black to indicate the press. How do I get it to stop chang...

Use image templates in buttons without borders

Hi, I'd like to use image templates on some of my buttons to have them behave as follow : Raised background in "normal" state, so the image appears engraved in the button When the button is pushed, the image turns to blue until it's released (like a selected toggle button) I need my button to be without borders I tried different com...

NSButton Aligned to the Right

I want to have a check box, like the standard one (first the check box and on the right its title) but I want it to be aligned from the right. If I change the alignment to the right then only the text will move to the right but the button itself will still be at the left. How would I achieve this without knowing the bounds of the NSButt...

want to remove a specific collectionview item with the remove button on that view

I have a collection view item and its prototype view. Within that prototype view I have a little x button. I want that button to remove the exact collection view item that it is on top of. I can remove a selected item if I click on the space around the x button but if I go straight to clicking the button before clicking the item it ...

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 application not for iPhone. TIA ...

An NSButton with two combined images (Cocoa OSX)

I want to make a type of popupbutton sort of like the action button on OSX. I need to make the button have two images makeup the representation of the button (the icon for the button and the downward facing disclosure triangle next to it). I was thinking maybe I could add the second image as a subview of the button but it seems that th...

Array of NSButton

I wonder if I can do something like IBOutlet NSButton * aButton[100]; It turns out that aButton cannot be seen in the interface builder. My app has lots of buttons and I want to see if there are way I can use looping to iterate the state of all buttons. ...

Cocoa: change cursor when it's over an NSButton

How can I change the cursor when it's over an NSButton? ...

How would I use a button on my app to set the current URL that a WebView is showing?

I need help. The title says it all. Thanks so much! :) ...

NSButton blue highlight

Hi. i want to make on/off gradient NSButton but with blue highlight like NSTabView select buttons. Is it possible to make this easy way? Or i should draw this manually? if i should draw this manually what is the best way to do this? (CIFilter or just NSGradient) thanks. ...

Dragging a button and dropping it at another location in its window

Hi all, I am trying a simple application with drag and drop: My application contains a window with a button over it. Idea is: user should be able to drag this button to another location in its window, such that its location changes but it performs same action when clicked! Can anyone suggest how can I implement it? Than...

Making a Cocoa Button look like is pressed, programatically...

The title pretty much says it all, I have some key events, that correspond to buttons also. What property/method to I have to set/call for a button to look depressed (change state?) for say half a second? Thanks alot in advance!! James Hartt ...

Key Value Observing and NSButton state

I'm trying to observe checkbox status and make appropriate changes in the app when checkbox status changes. In a window manager that manages the window with checkbox I have following observer setup: - (void)awakeFromNib { [myCheckBox addObserver:self forKeyPath:@"state" options:(NSKeyValueObser...

How to create NSButton with delayed NSMenu ?

Hi, In Cocoa i want to create an nsbutton with delayed menu. i.e., When clicked it should call the action method and when kept in pressed state for 2 seconds it should display a nsmenu. It is similar to "Build Active Target" button present in Xcode toolbar. Regards, Dhanaraj. ...