TOC | PREV | NEXT

Problem: You used to call [NXColorWell deactivateAllWells] when you swapped out an inspector view, but it's no longer implemented, and you need a general solution that works even when you don't know the id's of all the color wells.

Solution:
Add this to your C routines, and call it instead with the contentView which holds the inspector's colorwells:
      
      void
      deactivateAllWells(NSView *view)
      {
       if ([view isKindOfClass:[NSColorWell class]])
             [(NSColorWell *)view deactivate];
       else {
             NSArray *subs = [view subviews];
             int i = [subs count];
             if (i) {
                   while (i--)
                   deactivateAllWells([subs objectAtIndex:i]);
             }
       }
      }

Problem:
App crashes when accessing a color

Solution:
Most of the NSColor methods are "+" factory methods - which means that they are autoreleased. Which really means that you should be making a copy of them in your IVARS which get set:

      - setColor:(NSColor *)newColor
      {
            [color release];
             color = [newColor copyWithZone:[self zone]];
      }


TOC | PREV | NEXT
Match: Format:
Search:
Created by Stone Design's Create on 6/2/1997