Re: Show/Hide columns in NSTableView?
Re: Show/Hide columns in NSTableView?
- Subject: Re: Show/Hide columns in NSTableView?
- From: Andreas Mayer <email@hidden>
- Date: Thu, 27 Jul 2006 23:17:20 +0200
Am 27.07.2006 um 10:37 Uhr schrieb Fredrik Olsson:
Is there a more elegant solution to letting the user (And
programatically) toggle columns on and off?
Hm. I do have something like this. Not sure I'd call it an *elegant*
solution though.
It involves subclassing NSTableView *and* NSTableColumn and it uses
two private methods of NSTableView - since I couldn't get autosaving
to work properly without them.
Here are the interfaces:
@interface AMRemovableColumnsTableView : NSTableView {
IBOutlet id obligatoryColumnIdentifiers; // NSArray
NSSet *allTableColumns;
BOOL am_respondsToControlDidBecomeFirstResponder;
}
- (NSSet *)allTableColumns;
- (NSSet *)visibleTableColumns;
- (NSSet *)hiddenTableColumns;
- (NSSet *)obligatoryTableColumns;
- (BOOL)hideTableColumn:(NSTableColumn *)column;
- (BOOL)showTableColumn:(NSTableColumn *)column;
- (BOOL)isObligatoryColumn:(NSTableColumn *)column;
@end
@interface AMRemovableTableColumn : NSTableColumn {
IBOutlet AMRemovableColumnsTableView *mainTableView;
}
- (AMRemovableColumnsTableView *)mainTableView;
- (void)setMainTableView:(AMRemovableColumnsTableView *)
newMainTableView;
- (BOOL)hidden;
- (void)setHidden:(BOOL)flag;
@end
If anyone is interested, I'm gonna write a sample app and put the
code on my website.
Andreas
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden