Re: How to join NSScrollView and NSTableView programmatically
Re: How to join NSScrollView and NSTableView programmatically
- Subject: Re: How to join NSScrollView and NSTableView programmatically
- From: email@hidden
- Date: Thu, 22 Sep 2005 22:42:08 +0800
Hi,
You might use setDocumentView instead of insert the tableview to
contentView as a subview.
contentView is just a placeholder for real content,document, and clip
the content.
For more information you could refer file:///Developer/ADC Reference
Library/documentation/Cocoa/Conceptual/DrawViews/index.html
HTH,
MacSmith
On Sep 22, 2005, at 8:51 AM, Jesse Grosjean wrote:
I feel stupid asking this, but I've just spent the last 4 hours
trying to do something that I though would be very simple. I want
to create a scroll view and embed a table view in it in code. This
works to a point, but for the life of me i can't figure out how to
make the vertical scroller work right. I want the vertical scroller
to always be visible, but it show only show the jellybean drag area
when there are too many rows to fit in the content view.
But for some reason when I run my code the vertical scroller is
always showing showing that the view is scrollable. This has
something to do with the NSTableView's header view, but I don't
know what I need to do to fix it. This code is self contained, you
should be able to just paste, compile, and run to see what I mean:
unsigned int styleMask = NSTitledWindowMask | NSClosableWindowMask
| NSResizableWindowMask;
NSWindow *window = [[NSWindow alloc] initWithContentRect:NSMakeRect
(100, 100, 500, 500) styleMask:styleMask
backing:NSBackingStoreBuffered defer:YES];
NSView *contentView = [window contentView];
NSTableView *tableView = [[[NSTableView alloc] init] autorelease];
NSScrollView *scrollView = [[[NSScrollView alloc] initWithFrame:
[contentView frame]] autorelease];
[scrollView setHasVerticalScroller:YES];
[scrollView setHasHorizontalScroller:NO];
[scrollView setDocumentView:tableView];
[scrollView setAutoresizingMask:NSViewWidthSizable |
NSViewHeightSizable];
[contentView setAutoresizesSubviews:YES];
[contentView addSubview:scrollView];
[window orderFront:nil];
Thanks for any suggestions,
Jesse
_______________________________________________
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