Creating a nstextfield in a tab,
Creating a nstextfield in a tab,
- Subject: Creating a nstextfield in a tab,
- From: Andrea Salomoni <email@hidden>
- Date: Thu, 15 Dec 2005 12:53:00 +0100
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