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: Sam Griffith <email@hidden>
- Date: Tue, 15 Apr 2003 23:48:50 -0500
Actually since the ComboBox uses a NSTextCell, it too can have a graphic,
b/c NSCell has a setImage: method.
As for text selecting, I still think it should select based on the name of
the image. Does it do that? I don't know... I'm working on an example
now...
Thanks for the input though,
Sam
On 4/15/2003 10:28 PM, "Michael Grant" <email@hidden> wrote:
>
On 4/15/03 1:03 AM, "Sam Griffith" <email@hidden> wrote:
>
>
> The end goal is to have a ComboBox with all graphical images in it, so that
>
> the user is picking a graphic.
>
>
I thought the point of a combo box was that the user can either choose a
>
menu item or type in it. You can't type a graphic, right?
>
>
Michael
>
And On 4/15/2003 8:27 PM, "Marco Steinbach" <email@hidden>
wrote:
>
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.
_______________________________________________
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.