Fake NSTableView

Posts: 102
Joined: 2005.01
Post: #1
Good times.

Here is the code.

- (void)drawRect:(NSRect)rect
    int a, b = 0;
    for ( a = (int)([self frame].size.height/CELLHEIGHT) ; a >= 0 ; a--)    {
        if (a % 2)    {
        else    {
        glTranslatef(0.0f, [self frame].size.height-(b*CELLHEIGHT), 0.0f);
                glVertex3f(0.0f, 0.0f, 0.0f);
                glVertex3f(0.0f, CELLHEIGHT, 0.0f);
                glVertex3f([main frame].size.width, CELLHEIGHT, 0.0f);
                glVertex3f([main frame].size.width, 0.0f, 0.0f);
        /*//writing stuffs
        GCString *name = [[GCString alloc] init];    
        GCString *status = [[GCString alloc] init];
        [name setString:[[friends objectAtIndex:a] item].personName];
        [status setString:[[friends objectAtIndex:a] item].status];
        [name setColor:[NSColor blackColor]];
        [status setColor:[NSColor lightGrayColor]];
        [name setFont:@"Lucida Grande" withSize:12.0];
        [status setFont:@"Lucida Grande" withSize:10.0];
        [name setVisible:YES];
        [status setVisible:YES];
        [name drawAtPoint:NSMakePoint(20, a*CELLHEIGHT+17)];
        [status drawAtPoint:NSMakePoint(20, a*CELLHEIGHT+3)];*/
    [[self openGLContext] flushBuffer];

The problem is that there is a section of black at the bottom. It makes no sense my math seems like it should work... to me.

OK solved.

And this looks like windows and it sucks.
Quote this message in a reply
Posts: 1,199
Joined: 2004.10
Post: #2
Is your "GCString" garbage collected? Is that what "GC" stands for? Because if it isn't you're leaking like mad.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  NSTableView Nick 2 4,383 Aug 10, 2005 12:58 PM
Last Post: LongJumper
  custom NSTableView honkFactory 8 7,378 May 17, 2005 06:56 PM
Last Post: PowerMacX