• 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
check out the spreadsheet control! and NSTextViewCell Overlapping its bounds
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

check out the spreadsheet control! and NSTextViewCell Overlapping its bounds


  • Subject: check out the spreadsheet control! and NSTextViewCell Overlapping its bounds
  • From: Timothy Ritchey <email@hidden>
  • Date: Wed, 27 Mar 2002 18:31:41 -0500

Hi All!
Two things:

1) I've been working on a spreadsheet control, and am going through and polishing off all of the rough patches before I release an alpha version to the wild. I have a disk image with a test app that just has the spreadsheet control in the default PB app:

http://homepage.mac.com/tritchey/

I would appreciate it if anyone interested in such a beasty could take a look at its current (very pre-pre-alpha) state, and let me know what you would like to see. I have a hit list myself, but would like to get some additional input at this point. just bang on it, and let me know what behaviors seem out of place, etc.

2) One problem I am having is with text display in cells. For some reason, the last character of a text string will periodically overlap with the end of the cell. This is essentially a subclass of NSTextFieldCell. If you run the app, type some text in a cell that is larger than the cell, then grab the header and resize the cell. You will notice as you resize, that some characters overhang the bounds of the cell - Is this a known bug, or something I am doing wrong. I had the text wrapping, and only recently noticed this with non-wrapping text.

My drawing routine is (please, ignore the ugliness for now...):

- (void)drawRect:(NSRect)rect
{
NSBezierPath *path = [[NSBezierPath alloc] init];
int visibleRowIndex, rowCount, visibleColumnIndex, columnCount;
float start, end;
TRFloatRange rowFloatRange;
TRFloatRange columnFloatRange;
TRSSHeader *header;
TRPosition *pos = [TRPosition positionForRow:0 column:0];
TRSSCell *cell;
BOOL columnDrawn = NO;

if([self inLiveResize]) {
[self updateVisibleRangesForRect:rect];
}

[self updateDirtyRangesForRect:rect];

rowCount = NSMaxRange(dirtyRowRange);
columnCount = NSMaxRange(dirtyColumnRange);
for(visibleRowIndex = dirtyRowRange.location; visibleRowIndex < rowCount; visibleRowIndex++)
{
header = [visibleRows objectAtIndex:visibleRowIndex];
[pos setRow:[header index]];
rowFloatRange = [header range];
end = TRMaxFloatRange(rowFloatRange) - 0.5;
[path moveToPoint:NSMakePoint(rect.origin.x, end)];
[path lineToPoint:NSMakePoint(rect.origin.x + rect.size.width, end)];

for(visibleColumnIndex = dirtyColumnRange.location; visibleColumnIndex < columnCount; visibleColumnIndex++)
{
header = [visibleColumns objectAtIndex:visibleColumnIndex];
[pos setColumn:[header index]];
columnFloatRange = [header range];

if(!columnDrawn) // we only need to do this for the first row
{
start = TRMaxFloatRange(columnFloatRange) - 0.5;
[path moveToPoint:NSMakePoint(start, rect.origin.y)];
[path lineToPoint:NSMakePoint(start, rect.origin.y + rect.size.height)];

}
if(cell = [cells objectForKey:pos]) // see if there is a cell at our position
{

##### here is where the cell is drawn #######
[cell drawWithFrame:NSMakeRect(columnFloatRange.location, rowFloatRange.location,
columnFloatRange.length, rowFloatRange.length)
inView:self];
##### here is where the cell is drawn #######
}
}

columnDrawn = YES;
}
[path closePath];
[[NSColor gridColor] set];
[path setLineWidth:0.0];
[path stroke];
[path release];
[pos release];
}
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: check out the spreadsheet control! and NSTextViewCell Overlapping its bounds
      • From: Bob Newhart <email@hidden>
  • Prev by Date: Re: Dynamic Linking
  • Next by Date: Re: use AppKit;
  • Previous by thread: Re: Font in NSOutlineView (newbie question)
  • Next by thread: Re: check out the spreadsheet control! and NSTextViewCell Overlapping its bounds
  • Index(es):
    • Date
    • Thread