Re: "Select All" first in table view
Re: "Select All" first in table view
- Subject: Re: "Select All" first in table view
- From: Sam Stigler <email@hidden>
- Date: Fri, 11 May 2007 00:45:03 +1000
Why not just forget having the special row in the table, and instead
have a "Select All" menu item or toolbar item, etc.? I mean, a table
is meant to display data, not act as some kind of custom button. If
you use it as that, you're more likely to confuse your users than
anything else. See http://developer.apple.com/documentation/
UserExperience/Conceptual/OSXHIGuidelines/XHIGIntro/
chapter_1_section_1.html for reasons why it's a good idea to stick to
Apple's Human Interface Guidelines, and the "List Views" section at
http://developer.apple.com/documentation/UserExperience/Conceptual/
OSXHIGuidelines/XHIGControls/chapter_18_section_7.html for exactly
what the Guidelines say about table views.
Maybe, as a compromise sort of thing, you could do what one program
whose name I now cannot remember does: Have a normal table view, and
then just above it have a text field (which could made to look very
similar to a table view row) connected to your IBAction. Or if you
need the columns, run the program, put in the data you want in the
Select All row, take a command-shift-4 screenshot of that row, and
add that as an NSImageView directly above the table view.
-Sam
On May 11, 2007, at 12:11 AM, I. Savant wrote:
On 5/10/07, Micha Fuhrmann <email@hidden> wrote:
I need the first entry in the table to be "Select All",and to stay
there while the column is sorted. I've tried inserting a new object
in the array but I can understand why it doesn't want to since it's
pulling it's data from another NSArrayController.
This shouldn't be in the model (an "All" entity, or whatever you
tried) as it has *nothing* to do with your model, only how it's
displayed. This is a job for the controller layer.
I'm going to say something shocking: Bindings doesn't fit every
situation. :-) You'll probably need to use the table data source
methods (there's *nothing* wrong with using them and they're not
necessarily 'inferior' to using an array controller / bindings). I'd
go ahead and use the array controller so you get all the other
benefits (sorting, fetching, filtering, etc. based on bindings), but
use the table data source methods to actually provide the table's rows
since you're adding an additional layer of abstraction (select from
this list of model objects or select the "all" token that isn't actual
data).
In the data source, you could always return the count of the array
controller's content plus one as the -numberOfRows... and when asked
for the object value for table column/row, return your "All"
placeholder for row 0 and the rest would be the -arrangedObjects of
the array controller (which automatically respects the sorting).
You'd have to do some additional wiring to keep stuff in sync when
the contents change or are sorted (perhaps a subclass of
NSArrayController which tells your table's data source (or the table
itself) to reload the table data in its -rearrangeObjects method??).
You just need to keep in mind you're adding an additional layer of
abstraction between the list of model objects and the view that
represents them, so binding the table's columns directly to the array
controller isn't going to work the way you want it to since it doesn't
provide this functionality.
Of course all this can be avoided if your users simply select all
the rows in the table rather than a single row to represent all rows
... I've always had mixed feelings about this approach. :-)
If anyone has a better way, I'd love to hear it!
--
I.S.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
40mac.com
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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