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
2 answers

Setting text for NSTextView with an NSString variable, considering reference counting

I have the following code in a function in my .m file: desc = [my executeFunction]; // desc is returned by executeFunction data = [desc objectAtIndex:0]; // data is declared in the .h file data2 = [desc objectAtIndex:1]; [myTextField…
Chetan
  • 46,743
  • 31
  • 106
  • 145
0
votes
2 answers

"Building a Text Editor in 15 Minutes" reference example not working

I am trying to work on NSDocument, so I tried the Building a Text Editor in 15 Minutes example in the Text System Overview reference. I did some changes to code which was suggested, such as used property and synthesize in place of declaring and…
Devarshi
  • 16,440
  • 13
  • 72
  • 125
0
votes
1 answer

Scrolling a NSScrollView not working

I'm trying to scroll an NSScrollView to the bottom of the view using this code: NSPoint newScrollOrigin; if ([[self.chatScreen documentView] isFlipped]) { newScrollOrigin=NSMakePoint(0.0,NSMaxY([[self.chatScreen documentView]…
Alex
  • 1,388
  • 1
  • 10
  • 19
0
votes
2 answers

Seeking a simple Mac OS NSTextView example using AutoLayout

After much reading and experimenting, I still cannot get a simple TextView to resize fully in the horizontal direction using Xcode 5.0.2 in Mavericks. It resizes partially as the window is resized, then stops with long lines wrapped around even…
0
votes
1 answer

If NSTextView's physical window gets full, it won't update

I have an NSTextView that I'm making function as a console. To log stuff, I use the following method: - (void)log:(NSString *)logString { NSDateFormatter* formatter = [[NSDateFormatter alloc] init]; [formatter setDateFormat:@"yyyy-MM-dd…
Liftoff
  • 24,717
  • 13
  • 66
  • 119
0
votes
1 answer

How do I embed a child view within an NSTextView?

I have a text view, in which I would like to place other views, like so: ===================================== = This is an editable NSTextView... = = /-------\ = = |Subview| = = \-------/ …
personak
  • 539
  • 4
  • 15
0
votes
1 answer

NSTextView : how to subclass, override -mouseDown and still be able to select text?

I subclassed NSTextView. The .m is very simple and short : @implementation MyTextView - (void)mouseDown:(NSEvent *)theEvent { NSLog(@"click") ; } @end But now, I cannot select text anymore in MyTextView. How can I fix that?
Colas
  • 3,473
  • 4
  • 29
  • 68
0
votes
1 answer

Comparing NSString to NSTextView Range prior to Appending

Coding in Objective-C, I'm appending text to a NSTextView object named subCap in my code like so: [[[_subCAP textStorage] mutableString]appendString:[NSString stringWithFormat:@"%@", subcapLine]]; subcapLine will have two timecode values such as:…
ConleeC
  • 337
  • 6
  • 13
0
votes
1 answer

Results of NSTask in NSTextView

Thanks for the help. My code below works, returning results in the Console. I want to display the same results in a textView. Can't get it to work. Can anyone explain what I need to do? Thanks. -(IBAction)activateTask:(id)sender { NSURL *fileURL =…
Paul
  • 189
  • 10
0
votes
1 answer

Displaying multiple values in NSTextField using bindings

I am having an NSTableView with a bound NSArrayController. When one or more rows are selected, I want to show the name of the selected rows in an NSTextField. If only one row is selected the value should be shown, if multiple rows are selected the…
Erik
  • 11,944
  • 18
  • 87
  • 126
0
votes
1 answer

Building a document based application in Xcode 5

I am new to Xcode 5 and I want to create a document based application that loads my file (a basic text file with the extension .rt) into an NSTextView and allows me to save the contents of the NSTextView to the file Is this the right way to set it…
Coder404
  • 742
  • 2
  • 7
  • 21
0
votes
1 answer

VoiceOver announcing text change OS X

I have a non-editable text view (I can make it a text field, it doesn't matter). I change it programmatically when a user presses a button. I want VoiceOver to announce the change without moving the cursor. So the VO cursor stays on the…
0
votes
0 answers

Move Insertion point of an NSTextView and make the written content visible

I am working on one Mac app. In which I want to play few tricks with insertion point of an NSTextView. ![NSTextView with overlay on it][2] What am I doing is, I have an NSTextView (The whole image screen is of NSTextView) and above that I have…
Sid
  • 407
  • 1
  • 9
  • 17
0
votes
1 answer

Display an array in a NSTextView in a NSScrollView object

How would I display an array in a NSTextView in a NSScrollView Object in Xcode? For example, just having a simple array of strings like this: NSMutableArray *thisArrary = [NSMutableArrary new]; [thisArrary addObject:@"String 0\n"]; [thisArrary…
0
votes
1 answer

TextView text appending

That's my problem: I'd like to build a calculator, like this, So I put a text view and some buttons in the window but, now that's the code: Document.h // // Document.m // TheCalcolator // // Created by Imac on 15/12/13. // Copyright (c) 2013…