Re: How to make a NSComboBox with Images
Re: How to make a NSComboBox with Images
- Subject: Re: How to make a NSComboBox with Images
- From: Marco Steinbach <email@hidden>
- Date: Wed, 16 Apr 2003 03:27:22 +0200
Am Dienstag, 15.04.03, um 08:03 Uhr (Europe/Berlin) schrieb Sam
Griffith:
Hello,
I was looking at the online documentation for NSComboBox and I noticed
that
I can create a NSComboBoxCell with it's constructor that will take an
image.
I don't however see how to do the same thing with the Obj-C API.
The end goal is to have a ComboBox with all graphical images in it, so
that
the user is picking a graphic.
[...]
Given that you mixed up NSComboBox (which is based on NSTextFieldCells)
and NSPopUpButton (which uses NSMenuItems) in your posting, the way to
set an image to an item in NSPopUpButton is to set the image for the
NSMenuItem corresponding to the item in question.
For example like this:
// Add an item with no title to some NSPopUpButton, so only the image
is displayed
[myPopUpButton addItemWithTitle:@""];
// Now set the corresponding NSMenuItems image
[[myPopUpButton lastItem] setImage:myImage];
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.