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 & NSTextField in a NSTextView programmatically?

NSTextView & NSTextField in a NSTextView programmatically?
Thread Tools
rudynorff
Junior Member
Join Date: Oct 2000
Location: Germany
Status: Offline
Reply With Quote
Sep 16, 2003, 06:07 AM
 
Hello,

I was just trying out some stuff in cocoa and was wondering if it was possible to display a NSTextView and/or a NSTextField in a NSView programmatically?
If that is possible can you tell me how to go about it. I have tried for quite some time now!

Best regards,
rudy
     
Chuckit
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status: Offline
Reply With Quote
Sep 16, 2003, 12:28 PM
 
I don't think I understand what you're asking. You want to add an NSTextView to an NSView? Just use addSubview:.
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
     
smeger
Mac Elite
Join Date: Sep 2000
Location: Tempe, AZ
Status: Offline
Reply With Quote
Sep 16, 2003, 01:00 PM
 
  • someRectangle is the frame rectange for your text field in the superview's coordinate system. For example, NSRect someRectangle = NSMakeRect(0.0, 0.0, 100.0, 100.0);.
  • mySuperview is the view you want to place your text field into.

Code:
NSTextField *myTextField = [[[NSTextField alloc] initWithFrame: someRectangle] autorelease]; [mySuperview addSubview: myTextField];
Geekspiff - generating spiffdiddlee software since before you began paying attention.
     
rudynorff  (op)
Junior Member
Join Date: Oct 2000
Location: Germany
Status: Offline
Reply With Quote
Sep 16, 2003, 03:24 PM
 
Thanks alot guys! You're great, I'll try it out immediately!
     
   
 
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 05:42 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.,