I do something similar here, perhaps you can spot some discrepancy?

// Instantiate a special buttonCell that can be drawn in color and configure it CCDColoredButtonCell *colorCell = [[CCDColoredButtonCell alloc] init];
        [colorCell setButtonColor:[NSColor clearColor]];
        [colorCell setButtonType:NSMomentaryPushInButton];
        [colorCell setBezelStyle:NSShadowlessSquareBezelStyle];
        [colorCell setFont:[NSFont systemFontOfSize:15]];
        [colorCell setAllowsMixedState:YES];
        [colorCell setTarget:self];
        [colorCell setAction:@selector(myAction:)];
        [colorCell autorelease];
        
        // Initial size of the buttons matrix
        float mSize = 37 * squares - 2;
        
        // Create the matrix of tri-state color capable buttons
protoMatrix = [[NSMatrix alloc] initWithFrame:NSMakeRect(20, 60, mSize, mSize)
                mode:NSHighlightModeMatrix
                prototype:colorCell
                numberOfRows:squares
                numberOfColumns:squares];
        [protoMatrix setIntercellSpacing:NSMakeSize(5, 5)];
        [protoMatrix setCellSize:NSMakeSize(32, 32)];
        [protoMatrix sizeToCells];
        [protoMatrix autorelease];

        // Disable unused cells, set tag and title of the visible ones
        [self configureMatrix];

Create a NSTextFieldCell and customize it. Create a NSMatrix using
the "prototype" init version, and display it. All the custom
formatting is gone - all cells are vanilla NSTextFieldCells.

Loop through the matrix, and set each cell to a copy of the cell I
used as a prototype, using the "putCell..." method. Now it works fine.

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to