One of the columns in my NSTableView has its cell set to an NSPopUpButtonCell. This is all built very conventionally, in Interface Builder. I have bound to Content, Content Values and Selected Object, and it all functions correctly.

Except, and this started a couple weeks ago during development and I can't explain why, when the view is initially displayed, the cell in the selected row is "whited out". It draws immediately if I click on this row, or if I do anything to cause redrawing, such as activating a different application whose windows don't cover the cell. Also, when I click on the cell in one of the rows, it immediately "whites out" the value being displayed in the other rows above and below it. They remain whited out after I have dismissed the popup.

I kludge-fixed the first problem by subclassing the table view and sending extra -display messages to it, strategically delayed after - viewDidMoveToWindow. Really stinks.

I kludge-fixed the second problem by subclassing the cell and sending a -display message to the table view whenever the popup is "hit" or dismissed.

So now, the cells are still whited out initially but they reappear after a fraction of a second.

I'd also noticed that sometimes I need to click the popup cell twice before I get my menu. The first time, the text in the clicked popup and the text above and/or below it in one or more nearby rows gets whited out. Usually, the menu appears after 1 second but sometimes it does not. I've not been able to reproduce this today.

I have implemented quite a bit of code to dynamically generate the popup menu for each row, but I don't believe I'm doing anything on other threads, certainly not in displaying the menu. It's a conventional design, bindings set in Interface Builder.

Until I implemented my kludges, the table view was a plain old NSTableView, the cell was a plain old NSPopUpButtonCell, and the table column still is a plain old NSTableColumn.

Any ideas where I should push on this?

Jerry Krinock


STINKIN' CODE....

@implementation SSYDisplayAlotTableView

- (void)viewDidMoveToWindow {
    [super viewDidMoveToWindow] ;

    // This redraws after the view is redisplayed quickly,
    // such as after switching tabs
    [self performSelector:@selector(display)
               withObject:nil
               afterDelay:0.1] ;

    // This redraws after the view is displayed slowly,
    // such as when the window initially opens
    [self performSelector:@selector(display)
               withObject:nil
               afterDelay:1.0] ;

    // It seems that this second -display needs to occur
    // after the first display invoked by the system.
    // Of course, an even longer delay may be needed for slow Macs :(
}

@end


@implementation SSYDisplayAlotPopUpButtonCell

- (void)dismissPopUp {
    [super dismissPopUp] ;
    [[self controlView] display] ;
}


- (NSUInteger)hitTestForEvent:(NSEvent *)event
                       inRect:(NSRect)cellFrame
                       ofView:(NSView *)controlView {
    NSUInteger result = [super hitTestForEvent:event
                                        inRect:cellFrame
                                        ofView:controlView] ;
    [controlView display] ;
    return result ;
}

@end


_______________________________________________

Cocoa-dev mailing list ([email protected])

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 [email protected]

Reply via email to