How to see the whole string in NSTextFieldCell?

420 views Asked by At

When I put a long string inside my NSTableView the text isn't displayed wholly:

The string is too long

I need to allow user to see the whole string (maybe with scroll or tooltip, it doesn't matter). Any suggestions?

Thanks

1

There are 1 answers

0
guitarflow On

If it is ok to have a multiline text view, this would be the easiest solution. But from your example I guess the answer is no.

You could embed the NSTextField in a scroll view. If the text is longer than the allowed width, you could simply show the scroll handles. If not, they would not be shown and the user doesn't even see that it's a scroll view.

For both of the above examples, it will be helpful to know how long the text actually is and if the textfield is long enough to display the whole text.

You can do [textField sizeToFit] and [textField frame].size.width to check.