Hi,
I have designed one combobox with CustomComboBoxCell set from the Interface
Builder and trying to Change the Complete rectangle with my own image using
drawWithFrame.
Once I choose the any item from the DropDownList it is not displaying the
text immediately in the Textfield of the ComboBox. But it works fine after
clicking once into the Textfield. I have pasted my code for
CustomComboBoxCell. Please help me if I am missing anything.
@interface CustomComboboxCell(private)
- (void)initializations;
@end
@implementation CustomComboboxCell(private)
- (void)initializations
{
mImage = [NSImage imageNamed:@"ComboBox1"];
}
@end
@implementation CustomComboboxCell
- (id)init {
NSLog(@"CustomComboboxCell init");
self = [super init];
if (self != nil) {
[self initializations];
}
return self;
}
- (id)initWithCoder:(NSCoder *)aDecoder {
NSLog(@"CustomComboboxCell initWithCoder");
self = [super initWithCoder:aDecoder];
[self initializations];
return self;
}
- (void) dealloc
{
[mImage release];
[super dealloc];
}
- (void)drawWithFrame:(NSRect)bounds inView:(NSView *)controlView
{
NSLog(@"CustomComboboxCell drawWithFrame[%f %f - %f %f]", bounds.origin.x,
bounds.origin.y, bounds.size.width, bounds.size.height);
NSRect imageRect = bounds;//[self drawingRectForBounds:bounds];//[self
imageRectForBounds:bounds];
NSLog(@"Image rect [%f %f - %f %f]", imageRect.origin.x, imageRect.origin.y,
imageRect.size.width, imageRect.size.height);
if (mImage != nil) {
[mImage setFlipped:[controlView isFlipped]];
[mImage drawInRect:imageRect fromRect:NSZeroRect operation:
NSCompositeSourceAtop fraction:1.0];
}
}
Thanks in advance
-Mustafa
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"cocos2d discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/cocos-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---