Mailing Lists: Apple Mailing Lists

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

Custom view (NSSegmentedControl/NSButton) in NSToolbarItem - validate: method



Hi all,

I'm new to Cocoa programming and want to develop an application with a
Finder-like toolbar (specially, grouped buttons "backward"/"forward" in
a NSSegmentedControl).

I know (read in Apple Dev Doc and in mailing-lists) that :

- I have to subclass NSView (this is already done and my custom
view--NSSegmentedControl, is displayed in the toolbar),
- I have to implement theses methods in my subclass :
- (id)initWithFrame:(NSRect)frame;
- (void)drawRect:(NSRect)rect;
and an action method that will handle what segment has been clicked :
- (IBAction)segControlClicked:(id)sender;

But I have read too that :

- many calls to the toolbarItem are forwarded to the custom view (does
it mean that I should set the toolbarItem's target to the instance of
my custom view and set the action to a method--segControlClicked, of
the same instance?),
- I should subclass NSToolbarItem to override validate: method because
this method doesn't sent the message validateToolbarItem:(NSToolbarItem
*)theItem to custom toolbarItem's views,
- I should also implement every "forwards to -view if it responds"
methods too (ie : setTarget:, target, setAction:, action, ...)?

Finally, that get me bored and I feel like in front of a mountain of
code to write for a simple grouped pair of buttons :-(

Does anybody has an experience with this?

I've started doing lot of these stuffs but I get a problem dialing with
the segment of the NSSegmentedControl (no highlight blue color of the
selected segment, always the same selected segment sent whatever
segment is clicked; ...).

I am going to rest for while :-)

Thanks you all (forgive my english)

Cordialement.
--
Thierry Santacana - mailto:email@hidden
Girant - Responsable Diveloppements Web et Communication
Project:Omega SARL - www.projectOmega.com - "Divelopper l'alternative"
Til/Fax : 01 60 02 76 34 - GSM : 06 63 11 67 41
_______________________________________________
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.




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.