Re: Capsule-Style Toolbar Controls
Re: Capsule-Style Toolbar Controls
- Subject: Re: Capsule-Style Toolbar Controls
- From: Peter Ammon <email@hidden>
- Date: Fri, 18 Apr 2008 14:05:06 -0700
Thanks Stefan,
From the screenshot, it looks to me like the test app is not using
the unified title/toolbar metrics, but Mail is. Try checking the
unified title/toolbar checkbox in IB.
Your understanding of the NSToolbarItemGroup is correct. However, the
view will not be automatically resized to fit the labels. For now,
you will have to size the segments manually.
-Peter
On Apr 17, 2008, at 9:25 AM, Stefan Hafeneger wrote:
Hi Peter,
I uploaded two screenshots from Mail (in the background) and a demo
app (in the foreground) designed just in Interface Builder. The size
of the segmented control is exactly the same but there is a
difference in the baseline.
http://homepage.mac.com/stefan.hafeneger/.cv/stefan.hafeneger/Sites/.Public/CapsuleToolbar1.png-zip.zip
http://homepage.mac.com/stefan.hafeneger/.cv/stefan.hafeneger/Sites/.Public/CapsuleToolbar2.png-zip.zip
Concerning NSToolbarItemGroup: So I create a NSToolbarItemGroup and
with three "dummy" items and label the three dummy items. Then I
create a segmented control cell with 3 segments and set it to the
view of NSToolbarItemGroup. Is this correct? Will the view then be
automatically resized if the user enables or disables the labels?
With best wishes, Stefan
Am 16.04.2008 um 23:29 schrieb Peter Ammon:
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 (email@hidden)
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:
This email sent to email@hidden