I am trying to programmatically create a simple text input field for OSX that is only one line, has no scroll bar and automatically scrolls right and left when the user types and cursors. I have tried using a NSTextField, but it always seems to be multi line. I found the following link which seems to address the issue but it does not work for me.
make nstextfield single line
I create the NSTextField, add it to my view and set 'setUsesSingleLineMode' of it's NSCell to 'YES', but the text field still wraps text when I reach the end of the field rather that scrolling.
I have also tried using NSTextView with and without a surrounding NSScrollView, but, in this case I cannot get it to scroll either horizontally or vertically.
If someone can point me in the right direction, it would be greatly appreciated.
Thanks.
This is from Eclipse SWT, should be easy to translate from Java to Objective C:
NSTextField widget = new NSTextField ().alloc ();
widget.init ();
NSCell cell = widget.cell();
cell.setWraps(false);
cell.setScrollable(true);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With