nstextview

Left indentation of the NSTextView

大兔子大兔子 提交于 2019-12-12 02:42:59
问题 I wrote the following code: NSMutableParagraphStyle *paragraphStyle; double indent = 100 * mm2pt / 10.0; if ( !m_textView ) return; if ( start == -1 && end == -1 ) { if( style.HasLeftIndent() ) { paragraphStyle = [[NSMutableParagraphStyle alloc] init]; [paragraphStyle setHeadIndent: indent]; [paragraphStyle setFirstLineHeadIndent: indent]; [m_textView setDefaultParagraphStyle:paragraphStyle]; [paragraphStyle release]; } } else // Set the attributes just for this range. { NSRange range =

Cocoa: How to reposition Inspector Bar

爱⌒轻易说出口 提交于 2019-12-12 01:12:49
问题 My app has an NSTextView that uses the InspectorBar. However, it just sits at the top of the window like this: I want to be able to position it further down on the dark horizontal bar, which currently is an NSImageView. setFrame seems to have no effect. How can I do this? EDIT: I'm currently working on fixing someone else's implementation of a project. As you can see below, they were able to move the inspector bar, and they are not using NSToolbar. So it must be possible. Here's how this

NSTextView or NSTextField automatically resize bounds / frame?

江枫思渺然 提交于 2019-12-11 18:18:04
问题 I'm trying to use either an NSTextView or NSTextField which displays text that I am adding via textField.stringValue = [dictionary objectForKey:@"info"]; The problem is I need the bounds / frame of the text area to vertically re-size to show all of the text. The text varies from a couple of words (1 line) to a paragraph or two. When I try [textField sizeToFit]; It re-sizes the whole thing down to a single line which is absurdly too long (and goes off view). I need it to auto re-size its width

NSTextView textDidChange not called through binding

可紊 提交于 2019-12-11 17:44:13
问题 I have NSTextViews where I need to track the current end point of the text to place interface elements. I bind a model string to NSBindingName.value on the text view. When the text is edited I update the location of my interface elements in func textDidChange(_ notification: Notification) ...as a delegate to the NSTextView. However, if my model is the source of a string update, this delegate method is never called, even though the text is correctly updated in the NSTextView. So, am I doing

NSTextView select specific line

时光毁灭记忆、已成空白 提交于 2019-12-11 15:38:56
问题 I am on Xcode 10, Objective-C, macOS NOT iOS. Is it possible to programmatically select a line in NSTextView if the line number is given? Not by changing any of the attributes of the content, just select it as a user would do it by triple clicking. I know how to get selected text by its range but this time i need to select text programmatically. I've found selectLine:(id) but it seems to be for an insertion point. A pointer to the right direction would be great and very much appreciated. 回答1:

editable nstextview from interface builder

六月ゝ 毕业季﹏ 提交于 2019-12-11 15:12:13
问题 I'm unable get to edit an nstextview. Here is the steps I tried. From the interface builder, I dragged dropped a "Custom view" into another view. (I couldnt find a nstextview there.) I changed the class of the Custom view form "NSView" to "NSTextView" Next I run my project, I can see the text view getting rendered (the mouse cursor changed to text-mode on the mouse-hover of text view area) However, I have not been able to insert/type/edit any text. Note: I have tried setEditable,

NSTextView wont update unless I click on it, and it wont focus. Any ideas?

我们两清 提交于 2019-12-11 15:06:44
问题 I dont have time right this second to put some sample code, (Ill edit my question tomorrow and add some) but basically what happens is that I have a Window. It works fine usually, but if I use [myWindow setStyleMask:NSBorderlessWindowMask] to make it borderless, the NSTextView it contains will stop gaining focus even when you click on it: the ring will never appear, the cursor wont change and the scroll bar will remain gray. Something else that happens when I make it borderless is that it

How do I disable drag and drop on NSTextView?

左心房为你撑大大i 提交于 2019-12-11 11:38:10
问题 I have a NSWindowController that contains several NSViewControllers . I would like to universally accept drag and drop events with the NSWindowController class and not be intercepted by other views such as NSTextView (contained in a NSViewController ) How can I tell NSTextView to ignore the drag & drop event? 回答1: I found out that there were two things needed to skip past NSTextView 's interception of the drag and drop event. In the NSViewController containing your NSTextView : - (void

Mixing graphics in NSTextView?

南楼画角 提交于 2019-12-11 11:13:28
问题 I thought I read somewhere that there is a way to embed drawings or other non-text in a text view, but I can't find anything about it in the Apple documentation. Can anyone point me in the right direction? I'm trying to build an editor, not just a view. I'm imagining a special character in the underlying text, and based on text attributes, it would reserves some blank space in the text layout. ? Or maybe I need to layout blocks myself, using NSTextContainers and a custom NSView to flow text

Transparent NSTextView performance

北城以北 提交于 2019-12-11 10:56:10
问题 I have a NSWindow with a NSImage and a NSTextView above it with a long text http://www.gutenberg.org/cache/epub/100/pg100.txt and if I draw with a solid background, the text editing is fast. But if I draw with no background, [self setDrawsBackground:NO] it's very slow. Any updates? I have also tried [self setDrawsBackground:YES]; [self setBackgroundColor:[NSColor clearColor]]; Maybe with setBackgroundFilters of NSTextView? Thanks! 回答1: I found a partial solution. If you disable the smoothed