Change NSOpenPanel cancel button text (Cocoa OSX)

I would like to have a custom selection in which many features can be customized. One thing I can't figure out how to do is change the text of the cancel button. I found that the setPrompt method will change the text of the okay button, but I cannot find a similar method for the cancel button, is there such a method?

+2


a source to share


2 answers


There is no built-in method for this, but you can try iterating through the subzones of the content view of the panels and looking for a button to act on cancel:

and call setTitle:

.

Update: there is a private _setCancelButtonTitle:

method.



(Also, both of these are likely to be split into a sandboxed application.)

+4


a source


The setPrompt: method in NSSavePanel (superclass of NSOpenPanel) will do the job for you.



+1


a source







All Articles