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 > NSTextArea with subview like address book

NSTextArea with subview like address book
Thread Tools
depolitic
Registered User
Join Date: Feb 2003
Status: Offline
Reply With Quote
Aug 2, 2004, 09:35 PM
 
In address book you have a basic template selection of fields inside of a NSTextArea, you can add more fields to the text area by the plus and minus buttons on the left hand side, the question is how did Apple do this. I found this:

http://www.stepwise.com/Articles/Tec...-12-20.01.html

However this is only inside of a NSTableView Rows meaning that all rows are the same height.

What is the best way of doing this, like Apple did or is that the way?

thanks
     
Brass
Professional Poster
Join Date: Nov 2000
Location: Tasmania, Australia
Status: Offline
Reply With Quote
Aug 2, 2004, 10:07 PM
 
Originally posted by depolitic:
In address book you have a basic template selection of fields inside of a NSTextArea, you can add more fields to the text area by the plus and minus buttons on the left hand side, the question is how did Apple do this. I found this:

http://www.stepwise.com/Articles/Tec...-12-20.01.html

However this is only inside of a NSTableView Rows meaning that all rows are the same height.

What is the best way of doing this, like Apple did or is that the way?

thanks
I would very much like to know the answer to this question myself (see my thread of a week or so ago, about 2 NSTextView questions).

That is assuming you mean NSTextView not NSTextArea, which doesn't exist as far as I'm aware.

However, I'm not convinced that is actually what Apple are doing in the Address Book application. They may simply be using a whole lot of NSViews with a lot of complicated code to make sure they all stay in the right places and have the right dimensions.

For myself, I need to user to be able to control the layout of a particular type of document that is mostly attribtued string text, but also includes a table, and another block of text. Ideally, I would like to be able to have the table and block withing the main text view "in-line" with the other text. Is this what you mean?
     
depolitic  (op)
Registered User
Join Date: Feb 2003
Status: Offline
Reply With Quote
Aug 3, 2004, 12:07 AM
 
NSTextView it is just my Java background coming through. I am surprised that this address book trick is not better documented.

need to user to be able to control the layout of a particular type
YES, and I do agree that possible:

However, I'm not convinced that is actually what Apple are doing in the Address Book application. They may simply be using a whole lot of NSViews with a lot of complicated code to make sure they all stay in the right places and have the right dimensions.
     
Chuckit
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status: Offline
Reply With Quote
Aug 3, 2004, 09:39 AM
 
Originally posted by Brass:
However, I'm not convinced that is actually what Apple are doing in the Address Book application. They may simply be using a whole lot of NSViews with a lot of complicated code to make sure they all stay in the right places and have the right dimensions.
My guess is it's a custom NSControl. Though I have used an NSView subclass to accomplish basically the same thing before. It's not very difficult or even CPU-intensive to calculate where the fields should go.
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
     
sandsl
Senior User
Join Date: Aug 2002
Location: Oxford, England
Status: Offline
Reply With Quote
Aug 3, 2004, 02:04 PM
 
Theres sample code available from WWDC 2003 Session 424: Cocoa Tips and Tricks, called 'RaisedEditor' which demonstrates this. If anyone has this code, I'd be greatful if they'd post, or e-mail it.
Luke
     
Rickster
Mac Elite
Join Date: Feb 2001
Location: Vancouver, WA
Status: Offline
Reply With Quote
Aug 3, 2004, 04:28 PM
 
Techically, that code can't be shared. It makes sense that they embargo the WWDC sample code when it's for a prerelease OS, but Panther's been out for ten months now. </rant>

Anyway, the gist of it... the entire "card" area in Address Book (and the similar area in iCal's drawer) is a single NSTextView subclass, not a collection of fields/popups/etc. The subclass customizes the location and display style of text within it according to mouseMoved events and the text cursor location.
Rick Roe
icons.cx | weblog
     
   
 
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
Top
Privacy Policy
All times are GMT -4. The time now is 03:29 PM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,