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 > NSTextView and a little bit of configuring...

NSTextView and a little bit of configuring...
Thread Tools
Grizzled Veteran
Join Date: Jun 2002
Status: Offline
Reply With Quote
Jul 2, 2003, 10:45 AM
 
Hey guys,

This is what I want to achieve, if you open Mail, click Compose and put your cursor in the message NSTextView. You'll notice, that unlike the default NSTextView, the blinking cursor is much more indented.

Curious as I am, I opened up Mail's nib, found the compose window and saw that the text box was a Custom View. I can create custom views for text views, but if I can i'd prefer to use a normal everyday NSTextView, but I need to know how to do the indenting bit, its been driving me mad for ages.

If anyone has an answer/code, please reply!

Thankya
Oliver
     
Senior User
Join Date: Mar 2000
Location: Ithaca, NY
Status: Offline
Reply With Quote
Jul 2, 2003, 02:17 PM
 
I believe the method you're looking for is -[NSTextView setTextContainerInset:]. You can use this to specify the padding you want around the text in the text view. There's no UI in Interface Builder for it, but you can just add a line of code to your controller's awakeFromNib method to do it there.
     
Grizzled Veteran
Join Date: Jun 2002
Status: Offline
Reply With Quote
Jul 2, 2003, 03:22 PM
 
Hey,
I used that code:
[documentTextView setTextContainerInset: 3];
In awakeFromNib. But when I built I get the error:

error: incompatible type for argument 3 of indirect function call

Any ideas, I've never seen this error before.
     
Addicted to MacNN
Join Date: Nov 2002
Location: Seattle, WA
Status: Offline
Reply With Quote
Jul 2, 2003, 04:01 PM
 
that argument would seem to be an NSSize, which is a struct with a float width and a float height
     
Grizzled Veteran
Join Date: Jun 2002
Status: Offline
Reply With Quote
Jul 2, 2003, 04:18 PM
 
Sorry to be a newb, but how do I use floats?
     
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status: Offline
Reply With Quote
Jul 2, 2003, 04:58 PM
 
They're just numbers with a decimal point. 1.1, 5.8703, etc.
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
     
Grizzled Veteran
Join Date: Jun 2002
Status: Offline
Reply With Quote
Jul 2, 2003, 05:02 PM
 
Sry to ask, but how would I go about (in my code) setting it up so its 1 from the top and 2 from the sides?

Thanks!
Oliver
     
Fresh-Faced Recruit
Join Date: Dec 2001
Location: Wisconsin
Status: Offline
Reply With Quote
Jul 2, 2003, 06:03 PM
 
[theObject setTextContainerInset:NSMakeSize(desiredWidth, desiredHeight)];

NSMakeSize() is a simple C function that returns a NSSize structure.
     
   
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 03:46 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