Jump to content

NSTextView Questions (sorry - am newbie!)


1 post in this topic

Recommended Posts

Hello all,


I have a few questions about the NSTextView class. Apologies if these seem a bit basic - I'm pretty new to implementing Objective-C/Cocoa and am more used to programming in Javascript/PHP and other web languages. I'm working on a simple text editor to slowly build up some idea about how to manipulate objects and create custom designs. I am using Xcode 3 and Interface Builder 2 (in Leopard).


First Question:


In one of the ADC reference examples, (creating text editor in 15 mins) it seems to be that if you just create an NSTextView and a format menu, then you should automatically be able to call up the Fonts and Colors pallette - I did this, but although I can call up the colors panel I can't call up the font panel. I've made sure that "Font Panel" and "Rich Text" were selected in the attributes panel in IB 2 and have tried variously to re-bind the menu item to the Action in First Responder, but can't find the corresponding Font Panel Action, although I have managed to successfuly bind the glyphs panel and color panel instead. Similarily, the font menu doesn't work - all options are greyed out. Any ideas why this is happening and how to solve it?


Second Question:

While investigating the above, I turned everything on in the attributes panel for the textView (btw made sure that was selected and not ScrollView) including the Rulers. however although the Rulers show in IB before I test the interface, they dont show when I test the interface or run the built application. What am I missing?


Third Question:

underline: seems very straight-forward. Not so much setting the text bold. I'm not sure what method I should be using for this - I think it may be:

setMarkedTextAttributes: or something similar. Am I right?


Fourth Question(sorry!):

The trouble with Apple's online reference is that it does not include implementation examples. For example - when setting text attributes - what NSDictionary attributes am I required to set? How do I set them? what is the recommended syntax?


Much obliged. I'm sorry these questions are so long!




Link to comment
Share on other sites


  • Create New...