Questions on using a NSTextView as a source viewer.
Questions on using a NSTextView as a source viewer.
- Subject: Questions on using a NSTextView as a source viewer.
- From: Daryle Walker <email@hidden>
- Date: Tue, 07 Oct 2014 18:29:20 -0400
I implemented a new window XIB and controller class for my web-browsing project. It’s for “View Source.” It’s active if the current page’s WebDataSource object indicates it supports a text representation. The window just contains a NSTextView-wrapped-in-a-NSScrollView object provided by the Interface Builder portion of Xcode. The controller has properties for the source-text, source-URL, and title. These are used during user-interface Resume; the view-source window never references the originating web-browser window after creation. The original web-browser window could have its current-page changed or be closed independently of a view-source window; the web-browser window also doesn’t track its view-source windows, so you could (pointlessly) create as many view-source windows for a particular page as you like.
1. Although the text in the window expands vertically as needed, it never does horizontally. Wrapping always happens when lines are too long, but it adjusts as the width of the window is changed. How do I get “infinite” space horizontally? I tried various tweaks in Interface Builder and looked at various Apple guides, but I can’t turn off the horizontal wrapping.
2. I wonder if I should scrap this way of viewing source and use an attached sheet. This obviously gives up source-viewing as independent. I also have to add a property to the web-browser window to indicate if source-viewing is active (so I can Restore that).
—
Daryle Walker
Mac, Internet, and Video Game Junkie
darylew AT mac DOT com
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden