On Apr 16, 2008, at 1:27 PM, Stefan Hafeneger wrote:

Hi,

Has anyone tried to use the Capsule-Style Toolbar Controls in an app so that it looks and behaves like Mail or Preview? When I add them to my toolbar it looks like Mail. But if I compare them side by side the ones in Mail and Preview there is a 2 pixel difference of the baseline. And I think it looks better in Mail/Preview. When I add a multi-segment control I only have one Label (not two or more). In Mail and Preview it looks like there are as many labels as segments. You can "fake" this by adding blanks. But there is one more point: In Mail and Preview the size of the control is adjusted (I think depending on the size of the label(s)). Well, in the nib files from Mail and Preview there are no toolbars, so Apple builds them via code. So the question is: If I code them as well, is it possible to do the same that Apple does in Mail and Preview via NSSegmentedCell or is this all done by hand?

With best wishes, Stefan

Hi Stefan,

As of Leopard, this is all possible using standard AppKit controls, which Mail and Preview both use.

Regarding the two pixel difference in the baseline, this may be because the segmented control is too short and so is clipped. Try using sizeToFit. You may also be referring to different window metrics; try giving the window a unified title/toolbar to see if that gives the appearance you expect. It shouldn't affect the appearance much, but it does subtly change the toolbar positioning. If these don't fix your issue, maybe you can provide a screenshot so I understand what you mean.

To have multiple labels in a single toolbar item, make an NSToolbarItemGroup, and give it subitems. If you set a view (but not a label) on the Group, the labels of the subitems will be arranged under the view. If the view is a segmented control, the labels will be aligned with corresponding segments, assuming there's the same number of both. This is what Mail and Preview do.

I hope that's clear,
-Peter

_______________________________________________

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 [EMAIL PROTECTED]

Reply via email to