• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Displaying my view in a Window
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Displaying my view in a Window


  • Subject: Displaying my view in a Window
  • From: Chaffinch <email@hidden>
  • Date: Tue, 11 Feb 2003 12:35:15 +0000 (GMT)

Hi,

I am having a little problem with my project and hope someone here can help
me to understand it.

In Interface Builder I have a created an NSScrollView as a custom view in my
main window. I have defined an IBOutlet that connect to this NSScrollView.

In my code I have sub-classed NSWindowController. In this sub-class I
programmatically create a text view for placing in the NSScrollView created
with IB.

The problem is getting the actual text view to display, I originally tried
the following in the window controllers awakeFromNib:

[ scrollView setDocumentView:textView ];
[ window setContentView:scrollView ];
[ window makeKeyAndOrderFront:nil ];
[ window makeFirstResponder:textView ];

But what this actually seems to do is cover the whole of my window, and not
end up within the borders of the NSScrollView I created in IB. Reading the
documentation last night, am I correct in thinking that the Content View is
not written to directly but "contains" various NSViews which are written
into. So do I need to actually use addSubView here instead of
setContentView??

Further, if I define NSWindow * theWindow; in my window controllers header
file and then change the above code to:

[ scrollView setDocumentView:textView ];
[ theWindow setContentView:scrollView ];
[ theWindow makeKeyAndOrderFront:nil ];
[ theWindow makeFirstResponder:textView ];

everything seems to work as I would like. But, I never alloc or init
theWindow and never connect it to anything in IB. Why does this work? I am
sure this can't be correct.

Thanks




=====
Regards

Chaffinch
----------------------------------------------
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: Re: NSDirectoryEnumerator memory problem
  • Next by Date: Cocoa threads and socket I/O problems
  • Previous by thread: Scripting & Services
  • Next by thread: Fwd: Re: Displaying my view in a Window
  • Index(es):
    • Date
    • Thread