Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: SliderText = NSSlider + NSTextField



On 31.01.2008, at 00:47, John Richetta wrote:
I'd like to create a unified "SliderText" control, that maintains a single numeric value, using both a slider and a text field (the latter providing high precision, when required). Changing either one should update the other, and notify clients of changes, and actions, as normal controls would. I'd also like this pairing to be as "self maintaining" as possible: I don't want the UI controller (window, panel, etc.), to deal with any messages beyond those it might receive from a single control. Also, creating one of these in IB should be no harder than copy/pasting an existing paired control.


If you set up these controls in a window, then select them all, then hold down the mouse and wait a moment, they will "pop out" and get a shadow. Now you can drag them into the library, and from then on you'll be able to easily drag them out to create new controls of this type.

Of course, this means that if, one day, you realize you need an additional field for each of these sliders, you'll have to manually add it, which is less than optimal.

Your idea of using the container view to manage the slider and text fields is a start, however you will want to do it differently: Use an NSViewController (or if you need 10.4 support, roll your own equivalent class -- I think there's a UKNibOwner class on my web site as part of one of my downloads that does the same). Then you'll have one NIB containing the sliders and text fields, and the view controller will load that into the custom view. That way, if you want an additional field, you can change one NIB, and all your windows will follow suit.

Of course, for easier layouting, you may want to create an IBPlugin for your custom slider.

Cheers,
-- M. Uli Kusterer
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de




_______________________________________________

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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >SliderText = NSSlider + NSTextField (From: John Richetta <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.