• 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
Re: Creating a nstextfield in a tab,
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Creating a nstextfield in a tab,


  • Subject: Re: Creating a nstextfield in a tab,
  • From: Andrea Salomoni <email@hidden>
  • Date: Thu, 15 Dec 2005 15:36:58 +0100

Thank you a lot Phil,

I will wait for your example!!!

very kind!
Andrea

Il giorno 15/dic/05, alle ore 15:24, Philip Dow ha scritto:

Hi Andrea,

I don't have any links, but I'm sure someone out there does. This is a really simple use of multiple nibs. If you can give me a couple of hours, I'll write a quick example for you, unless someone else can point you to something.

-Phil

On Dec 15, 2005, at 2:56 PM, Andrea Salomoni wrote:

Hi Phil and thank you!

Have you a good link for a multiplenib app tutorial?

Thank you very much
Andrea

Il giorno 15/dic/05, alle ore 14:35, Philip Dow ha scritto:

Hi Andrea,

If you need to have multiple copies of an NSTextView, try creating a master copy in Interface Builder. Put a view in the nib file and inside the view include an nstextview, which will automatically generate the necessary scrolling stuff.

Now sublcass NSObject and make your subclass the nib file owner. Inside the init method of your subclass, have it claim the nib file using [NSBundle loadNibNamed:@"MyNibFile" owner:self];

Also in your subclass, include a method that returns that main view. Then, whenever you need to add another text view to a tab, initialize your subclass, grab the main view that contains the text and scroll views using your custom method, and add that main view to the tab.

Hope that makes sense!
-Phil

On Dec 15, 2005, at 12:53 PM, Andrea Salomoni wrote:

Hi to all,

I need to create dynamically a certain number of tab that keeps inside an istance of nstextview.

NSTextView *chatView;
int a = [theTabView indexOfTabViewItemWithIdentifier:aNick];
if (a == NSNotFound)
{
id * lastTab;
NSTabViewItem * thePvtTab = [[NSTabViewItem alloc] initWithIdentifier:aNick];
[theTabView addTabViewItem:thePvtTab];
[thePvtTab setLabel:aNick];
NSScrollView *scrollview = [[NSScrollView alloc]
initWithFrame:NSMakeRect(0, 50, 500, 500)];
NSSize contentSize = [scrollview contentSize];
[scrollview setBorderType:NSGrooveBorder];
[scrollview setHasVerticalScroller:YES];
[scrollview setHasHorizontalScroller:NO];
chatView = [[NSTextView alloc] initWithFrame:NSMakeRect(0, 0,contentSize.width, contentSize.height)];
[chatView setVerticallyResizable:YES];
[chatView setHorizontallyResizable:NO];
[chatView setAutoresizingMask:NSViewWidthSizable];
[chatView setMinSize:NSMakeSize(0.0, contentSize.height)];
[chatView setMaxSize:NSMakeSize(1e7, 1e7)];
[chatView setDrawsBackground:TRUE];
[chatView setBackgroundColor:[NSColor whiteColor]];
[chatView setEditable:TRUE];
[chatView setRichText:TRUE];
[chatView setSelectable:TRUE];
[[chatView textContainer] setContainerSize:contentSize];
[[chatView textContainer] setWidthTracksTextView:YES];
[scrollview setDocumentView:chatView];
[thePvtTab setView: scrollview];
[theTabView selectLastTabViewItem:(id)lastTab];
[chatView insertText:aMess];
}
else
{
NSTabViewItem * thePvtTab = [theTabView tabViewItemAtIndex:a];
NSScrollView * scrollview = [thePvtTab view];
chatView = [scrollview documentView];
[chatView insertText:aMess];
}
}
When I run the app all works (the threads too), but if a scroll the textview after some lines the app crash!
I think the problem is NSScrollView NSMakeRect
Where the last 500 is wrong...
How can I modify it to mantain the scroll infinite?
thks
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40metagraphics.it

This email sent to email@hidden

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden
References: 
 >Creating a nstextfield in a tab, (From: Andrea Salomoni <email@hidden>)
 >Re: Creating a nstextfield in a tab, (From: Andrea Salomoni <email@hidden>)
 >Re: Creating a nstextfield in a tab, (From: Philip Dow <email@hidden>)

  • Prev by Date: Refresh bug in AppKit on OS X 10.4.x?
  • Next by Date: CoreData and document loading
  • Previous by thread: Re: Creating a nstextfield in a tab,
  • Next by thread: Getting a 128x128 icon for a file or file type
  • Index(es):
    • Date
    • Thread