Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: Show/Hide columns in NSTableView?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Show/Hide columns in NSTableView?




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
References: 
 >Show/Hide columns in NSTableView? (From: Fredrik Olsson <email@hidden>)



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

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.