Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Wrap NSButton title

Any way to have a NSButton title to wrap when it's width is longer than the button width, instead of getting clipped?

I'm trying to have a radio button with a text that can be long and have multiple lines. One way I thought about having it work is to have an NSButton of type NSRadioButton but can't get multiple lines of text to work.

Maybe my best alternative is to have an NSButton followed by an NSTextView with the mouseDown delegate function on it triggering the NSButton state?

like image 229
Carlos Barbosa Avatar asked Mar 22 '09 14:03

Carlos Barbosa


1 Answers

I don't believe you can. You'd have to subclass NSButtonCell to add support for this.

That said, it's typically a bad idea to have multiple lines of text on a button. A button label should concisely represent the action performed:

The label on a push button should be a verb or verb phrase that describes the action it performs—Save, Close, Print, Delete, Change Password, and so on. If a push button acts on a single setting, label the button as specifically as possible; “Choose Picture…,” for example, is more helpful than “Choose…” Because buttons initiate an immediate action, it shouldn’t be necessary to use “now” (Scan Now, for example) in the label.

What are you trying to do?

like image 145
Sören Kuklau Avatar answered Oct 11 '22 12:10

Sören Kuklau