Re: Any examples of how to implement an inspector window?
Re: Any examples of how to implement an inspector window?
- Subject: Re: Any examples of how to implement an inspector window?
- From: Erik Buck <email@hidden>
- Date: Thu, 15 Nov 2007 11:05:00 -0800 (PST)
The Sketch example application on your hard disk includes an inspector I believe.
In addition, a search of cocoabuilder http://www.cocoabuilder.com/search/archive/cocoa?words=inspector is revealing: http://www.cocoabuilder.com/archive/message/cocoa/2002/8/7/68068
There are at least two popular approaches:
1) Send a notification whenever selection changes and observe the notification in the inspector's controller
2) Use the applicationDidUpdate: delegate method or notification that already exists, and then use the keyWindow, mainWindow, and firstResponder methods to get detailed selection status
2.5) I like to use applicationDidUpdate: and sendAction:(SEL)anAction to:(id)aTarget from:(id)sender
- (void)setObjectToInspect:(id)someObject
{
// remember someObject and update the inspector...
}
- (void)applicationDidUpdate:(NSNotification *)aNotification
{
[[NSApplication sharedApplication] sendAction:@selector(updateSendersObjectToInspect:) to:nil from:self];
}
Then, the first object in the responder chain that responds to updateSendersObjectToInspect: will simply call [sender setObjectToInspect:] passing whatever object should be inspected.
Coming from Carbon, you may need to educate yourself about basic Cocoa concepts such as the responder chain, targets, actions, notifications, key window, and main window.
_______________________________________________
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