[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
NSScrollView bug
From: |
Andreas Höschler |
Subject: |
NSScrollView bug |
Date: |
Thu, 6 Apr 2006 16:55:50 +0200 |
Hello all,
we just worked around a very annoying bug somewhere in the
NSScrollView-NSSplitView-NSTableView code, that caused a bad effect
when scrolling the table view with the horizonatl scroller to the right
margin, but just change the order of the staements
[scrollView setDocumentView:textView];
[scrollView setHasHorizontalScroller:([self
boolValueForAttribute:@"hasHorizontalScroller"] == 0 ? NO : YES)];
[scrollView setHasVerticalScroller:([self
boolValueForAttribute:@"hasVerticalScroller"] == 0 ? NO : YES)];
On GNUstep you must first set the documentVie wan dthen the scrollers.
If you set the scrollers first you get crap. Since this problem can be
easly worked around I am not motivated enough right now to find the
piece of code that causes the problem but it has to do with the frame
of the headerView (documentView of on splitView) and the frame of the
tableView (documentView of anotehr splitView). The x-coordinates are
not the same when a vertical scroller exists. This causes the problem
(scrolling is constrained at the right margin). If anybody has a clue
and knows where to fix this go ahead. We are happy for now that we have
found a work around.
Thanks!
Regards,
Andreas
PS: I don't know what the OPENSTEP spec says about it, but we found it
very handy to have the following implementation of sizeLastColumnToFit
in NSTableView.m.
- (void)sizeLastColumnToFit
{
if ((_super_view != nil) && (_numberOfColumns > 0))
{
float excess_width;
NSTableColumn *lastColumn = nil;
int i;
excess_width = NSMaxX ([self convertRect: [_super_view bounds]
fromView: _super_view]);
excess_width -= NSMaxX (_bounds);
_tilingDisabled = YES;
for (i = _numberOfColumns - 1 ; i >= 0 ; i--)
{
NSTableColumn *column = [_tableColumns objectAtIndex:i];
if ([column isResizable])
{
float column_width = [column width];
float contrib = MIN([column maxWidth] - [column width],
excess_width);
column_width += contrib;
[column setWidth:column_width];
excess_width -= contrib;
}
if (excess_width <= 0.0) break;
}
_tilingDisabled = NO;
[self tile];
}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- NSScrollView bug,
Andreas Höschler <=