Graham,

Thanks for the answer, but I think you didn't get what I want to do. Or I 
didn't make myself clear enough.

> Either create the control in code or create it in IB. Don't do both.

Ok, I can create the NSSegmentedControl in code, but I got to have an NSView to 
load it into, anyways. Even if this view is just a placeholder, as in Apple's 
"Button Madness" sample. I tried this, but I can't get it to work in a toolbar, 
only in a window.

> I'm not sure what advantage the code approach might have here - I haven't 
> found a need to use toolbar groups myself (though presumably they solve a 
> problem I haven't needed to solve so far), but for a segmented control just 
> drop it in and set it up in IB, works fine, no code required (except an 
> action method to do something with it, and maybe an outlet if you need to set 
> it up at awake time).


Keep in mind that I want to have labels for the segments, not for the whole 
NSSegmentedControl. And I want these labels to be shown below the segments, not 
inside them, where I am using images (just like Mail, for example). I can't 
find a way to do it from IB.

I've found a page on stackoverflow.com that suggests this is the right way to 
do it. NSToolbarItemGroup Reference also seems to suggest it's the right way:

> If you set a label on the parent item:
> 
> [group setLabel:@"Navigate"];
> you get two grouped items with one shared label.
> 
> If instead you set a view on the parent item, you get two labels with one 
> shared view:
> 
> [group setView:someSegmentedControl];

So, I still can't get it to work. I am reading "Toolbar Programming Topics for 
Cocoa" to check if I missed something.


Cheers,
Flavio

On 04/05/2010, at 21:46, Graham Cox wrote:

> 
> On 05/05/2010, at 9:54 AM, Flavio Donadio wrote:
> 
>> Finally, in Interface Builder, I inserted an NSSegmentedControl in my 
>> toolbar and bound it to the outlet  in the App Delegate instance in the NIB.
>> 
>> It doesn't work. My segmented control doesn't get the images or labels. 
>> Should it be done this way?
> 
> 
> 
> 
> --Graham
> 
> 

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to