Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > customizing layout in nstextfield?

customizing layout in nstextfield?
Thread Tools
Forum Regular
Join Date: Mar 2001
Location: canada
Status: Offline
Reply With Quote
Mar 25, 2006, 04:24 AM
 
Hi,

I would like to customize the text layout in some of my nstextfields. Normally, the fields are just one line but they wrap text and if more than one line is being used, they grow vertically to display all the text. This hasn't been too difficult to implement (thanks to sample code found on the Internet and in Apple's documentation).

However, I would like the lines after the first to be automatically indented when the user types, to visually indicated that it is only one text field (I have a number of them arranged in an nxm grid). I'm not sure how to go about doing this.

I've been going through Apple's Text Layout Programming Guide but to be honest am a little overwhelmed. There's lots of information there that doesn't seem to exactly address what I need, and other information that seems to be more or less what I'm looking for but without the nitty-gritty details or any examples. For that, I realize I need to delve into the class documentation, and I've been looking at NSTypesetter/NSATSTypesetter and NSLayoutManager, but it's still not clear to me exactly what to do.

My rough idea of what will need to be done is as follows:
Replace the field editor for my nstextfields with a custom NSTextView subclass, which will be hooked up to a subclass of NSLayoutManager. And I may need a custom NSATSTypesetter for the layout manager.

Am I on the right track here? If so, could someone please point me towards the exact methods I will need to override in my subclasses? If anyone's done anything like this I'd appreciate your input. I know I should just charge ahead and start trying to configure things and play around, but I thought a little guidance might save me some time.

Thanks,
parsec
     
parsec  (op)
Forum Regular
Join Date: Mar 2001
Location: canada
Status: Offline
Reply With Quote
Mar 27, 2006, 06:24 PM
 
edit: scratch what i said about having figured it out. simply popping nstextcontainer subclass into the field editor kind of worked while editing but once editing stopped i lost the layout. i also had some other issues. grr
(Last edited by parsec; Mar 29, 2006 at 02:09 AM. )
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 09:34 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2