Questions tagged [nstextview]

NSTextView is the front-end class to MacOS's Application Kit text system. It draws the text managed by the back-end components and handles user events to select and modify its text. While NSTextView is a subclass of NSText—which declares the most general Cocoa interface to the text system—NSTextView adds major features beyond the capabilities of NSText.

Text views are user interface objects instantiated from the NSTextView class. Text views typically display multiple lines of text laid out in paragraphs with all the characteristics of sophisticated typesetting. A text view is the main user interface to the Cocoa text-editing system. It handles user events to provide text entry and modification, and to display any font, including those of non-English languages, with arbitrary colors, styles, and other attributes.

The Cocoa text system supports text views with many other underlying objects providing text storage, layout, font and attribute manipulation, spell checking, undo and redo, copy and paste, drag and drop, saving of text to files, and other features. NSTextView is a subclass of NSText, which is a separate class for historical reasons. You don’t instantiate NSText, although it declares many of the methods you use with NSTextView. When you put an NSTextView object in an NSWindow object, you have a full-featured text editor whose capabilities are provided “for free” by the Cocoa text system.

871 questions
0
votes
1 answer

Bind enabled of NSButton to selection in NSTextView

I have a button that does something to the selected text in NSTextView. If nothing is selected then nothing happens when the button is pressed... so can the enabled property of a button be bound to whether or not some text is selected?
regulus6633
  • 18,848
  • 5
  • 41
  • 49
0
votes
1 answer

NSTextView with text bubbles

What technique to use, to create a TextView, containing text bubbles for email, similar as in email
Peter Lapisu
  • 19,915
  • 16
  • 123
  • 179
0
votes
1 answer

Converting millimiters to Cocoa points

ALL, This page states that I need to pass points to this function. What is considered a "point" for Cocoa and how do I convert a millimeters to points? Thank you.
Igor
  • 5,620
  • 11
  • 51
  • 103
0
votes
1 answer

Horizontal scroll bar for NSText

ALL, I'm looking at the documentation, but it is not clear to me: To set up both horizontal and vertical scroll bars, use the statements in Listing 4 in place of the corresponding statements in the previous listings. It does not say, however,…
Igor
  • 5,620
  • 11
  • 51
  • 103
0
votes
1 answer

Returning NSTextView's Selection Attributes

When you use TextEdit and have a selection of string, it will give you the selection color, font, size and other attributes as you see above. How do you get those text selection attributes? I'm certain that I need to use the…
El Tomato
  • 6,479
  • 6
  • 46
  • 75
0
votes
1 answer

How to scale NSTextView to show rich text in actual size?

The rich text in an NSTextView displays on my screen (27" Mac) a lot smaller than the font size would imply, although it prints correctly, and is the correct size if pasted in to another app (e.g. OpenOffice). TextEdit shows the same behaviour. The…
AlexT
  • 596
  • 7
  • 15
0
votes
2 answers

Can't insert NSAttributedString into NSTextView

Previously I've been able to use the following code to place attributed text into an NSTextView field [[self->content textStorage] appendAttributedString:contentString]; However, upon updating to the Xcode 6 Beta to develop for Yosemetie, what used…
SteppingHat
  • 1,199
  • 4
  • 19
  • 50
0
votes
1 answer

Multiple undo managers for a text view

I've a text view that gets its content from an attributed string stored in a model object. I list several of these model objects in a drawer and when the user clicks on one the text view swaps its content. I now need to also swap the undo manager…
ruipacheco
  • 15,025
  • 19
  • 82
  • 138
0
votes
0 answers

NSTextView does not resize when subviews are added

In my OS X application I have a window with a split view which has 3 scrolling subviews. In the far right subview I have a scroll view which contains a clip view which contains a text view. When I add text to this NSTextView it resizes…
0
votes
1 answer

Make specified text in NSTextView Bold

I am using a little bit of code to change the text in an NSTextView NSString *string = @"This is a title\n\nThis is some info"; [content setString:string]; I would like to make the text "This is a title" the only text that is bold when displaying…
SteppingHat
  • 1,199
  • 4
  • 19
  • 50
0
votes
1 answer

Change NSTextView content outside an IBAction Method

I'm trying to modify the string contents of an NSTextView object. So far I've been able to make it work with the following code. .h file #import "AppDelegate.h" @interface InterfaceManager : AppDelegate { IBOutlet NSTextView…
SteppingHat
  • 1,199
  • 4
  • 19
  • 50
0
votes
2 answers

NSTextView displaying HTML via Cocoa Bindings

I've got a string with some simple HTML in it (mainly just and tags). I'm displaying them in an NSTextView using Cocoa Bindings. Unfortunately the html just shows up inline, it doesn't actually change the formatting. Is there a way to do get…
jsd
  • 7,673
  • 5
  • 27
  • 47
0
votes
1 answer

NSTextView determine if NSTextAttachment is present

in my MyDocument class I need to determine if there is an image in my NSTextView, so I can prevent users from saving documents as RTF although RTF doesn't support images. Could someone point me in the right direction?
Pripyat
  • 2,937
  • 2
  • 35
  • 69
0
votes
1 answer

How do I set state of a Bold format button for a NSTextView?

I have a NSTextView that I want to add format buttons for (bold, italics, etc). Right now, I have a button set to "toggle" type, with different images for on/off states. The toggle method checks the state of the button and send the shared…
Steven Hovater
  • 1,389
  • 2
  • 12
  • 25
0
votes
2 answers

NSTextView rounded border / stroke in Cocoa

I am subclassing NSTextView and over-riding the drawRect method in order to draw an NSBezierPathWithRoundedRect around the textview, however - as it has rounded edges, they interfere with the text in the text view. Is there any way to apply some…
mootymoots
  • 4,545
  • 9
  • 46
  • 74