Re: custom NSPopupButton
Re: custom NSPopupButton
- Subject: Re: custom NSPopupButton
- From: Ken Tozier <email@hidden>
- Date: Sun, 28 Jan 2007 18:01:23 -0500
On Jan 28, 2007, at 5:25 PM, PGM wrote:
I'm making a floating palette which packs several popup menus in a
very tight space and would like to customize them so they don't
look so clunky. I don't want to lose any of the other
functionality of popup buttons just change how it looks. What's
the easiest way to do something like that?
If you want to pack them horizintally, NSSegmentedControl may be a
solution.
They need to be vertical unfortunately.
Below is what I have so far. An NSPopupMenuButton subclass. I set the
"custom class" in IB to KFlatPopUpButton but for some reason. the
initWithFrame never gets called even though the popup appears in the
window. There are literally hundreds of methods in NSPopupMenuButton
and all of it's superclasses could someone point be where I should be
doing the custom initialization?
Many thanks
Ken
@interface KFlatPopUpButton : NSPopUpButton
{
}
- (id)initWithFrame:(NSRect) frameRect;
@end
- (id)initWithFrame:(NSRect) frameRect
{
self = [super initWithFrame: frameRect];
NSBundle *bundle = [NSBundle pmxPluginBundle];
NSLog(@"bundle = %@", bundle);
NSString *imagePath = [bundle pathForResource: @"bar-normal"
ofType: @"png"];
NSLog(@"imagePath = %@", imagePath);
NSImage *image = [[NSImage alloc] initWithContentsOfFile:
imagePath];
NSLog(@"image = %@", image);
[[self cell] setImage: image];
return self;
}
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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