• 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
setting up an NSTextView manually
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

setting up an NSTextView manually


  • Subject: setting up an NSTextView manually
  • From: David Harper <email@hidden>
  • Date: Wed, 27 Jun 2007 15:10:10 -0400 (EDT)

Hi,

I've referred to this document :
http://developer.apple.com/documentation/Cocoa/Conceptual/TextArchitecture/Tasks/AssembleSysByHand.html

and produced the following code:
{
    NSTextStorage *textStorage = [[NSTextStorage alloc] init];
    NSLayoutManager *layoutManager = [[NSLayoutManager alloc] init];
    [textStorage addLayoutManager:layoutManager];

    NSRect cFrame = NSMakeRect(100,100,100,100);
    NSTextContainer *container = [[NSTextContainer alloc] initWithContainerSize:cFrame.size];
    [layoutManager addTextContainer:container];
    NSTextView *textView = [[NSTextView alloc] initWithFrame:cFrame textContainer:container];
    [myWindow setContentView:textView];
    [myWindow makeKeyAndOrderFront:nil];
    [textView insertText:@"Text Goes Here"];
    [textView setBackgroundColor:[NSColor grayColor]];
    [textView release];
    [layoutManager release];
    [container release];
}

my goal is to set up a text container and text view within a window, that doesn't fill the entire window.  When the action that executes this code is invoked, the gray background color of the textView fills the entire window.  However, the text container itself is a 100x100 square at the top left of the text view.  Why is the cFrame I'm using being ignored?  What happened to the origin?  I expect that since the text container was placed at the top left of the window, y increases downward in an NSView.  Any help is greatly appreciated.
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: setting up an NSTextView manually
      • From: Martin Wierschin <email@hidden>
    • Re: setting up an NSTextView manually
      • From: Keary Suska <email@hidden>
  • Prev by Date: Re: Error and Exception Handling: When to use
  • Next by Date: Re: Bindings / NSTableView (limitation ?)
  • Previous by thread: Re: didFinishPlaying NSSound
  • Next by thread: Re: setting up an NSTextView manually
  • Index(es):
    • Date
    • Thread