• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
CustomComboboxCell not displaying the selected text
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

CustomComboboxCell not displaying the selected text


  • Subject: CustomComboboxCell not displaying the selected text
  • From: Symadept <email@hidden>
  • Date: Fri, 25 Sep 2009 15:47:26 +0800

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
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden

  • Prev by Date: Re: Subview drawn with reverted order
  • Next by Date: App Crashing on a second AppleScript call
  • Previous by thread: Re: How to create a control just as RGB Sphere and Alpha bar
  • Next by thread: App Crashing on a second AppleScript call
  • Index(es):
    • Date
    • Thread