In article <uce-A0C594.15245212062008@[EMAIL PROTECTED]
>,
Gregory Weston <uce@[EMAIL PROTECTED]
> wrote:
> In article <2oydneAWac0i9czVnZ2dnUVZ_qLinZ2d@[EMAIL PROTECTED]
>,
> Don Bruder <dakidd@[EMAIL PROTECTED]
> wrote:
>
> > The CocoaDev site that Reinder pointed me at was *VERY* useful - At
> > least now I think I've got the beginnings of a grip on how to use
> > NSTableView.
> >
> > Except for one minor detail...
> >
> > ...
> >
> > // This routine appears to never get called.
> > // Putting a breakpoint (or several of them) anywhere in it does
nothing
> > whatsoever. I strongly suspect that this is the reason I'm getting a
> > blank NSTableView displayed, but I don't know where to look for the
> > problem. If it were to execute, it looks like it *SHOULD* do what it's
> > supposed to. But it doesn't seem to get executed, and I don't know
why.
> > - (id)tableView:(NSTableView *)aTable
> > objectValueForColumn:(NSTableColumn *)aCol row:(int)aRow
> > {
> > id loc_id, loc_dat;
> > NSMutableArray *loc_col;
> >
> > loc_id = [aCol identifier];
> > if (loc_id != nil)
> > {
> > loc_col = [itemList objectForKey:loc_id];
> > if (loc_col != nil)
> > {
> > loc_dat = [loc_col objectAtIndex:aRow];
> > }
> > }
> > return (loc_dat);
> > }
>
> The first thing I want to say is this:
>
> A dictionary of arrays is going to be a lot harder to sort than an array
> of dictionaries when/if you decide that's something you want to do.
Keep in mind that I've pretty much lifted everything involved from
CocoaDev's example, which is, no doubt, anything but optimal for what
I'm doing...
The way I've got things built now, a single swap during the sort is
actually going to involve seven swaps. I can see that already. So
slower/more tedious? Definitely. Harder? I can't see why. A generic
"Here's an array and two indices - swap the items at the indices"
routine won't be that difficult to do.
However, I've got no doubt that I'm going to want to twiddle things to
match what you're suggesting eventually - First, though, I need to get
things working *AT ALL* before I try making them work "insanely great".
Crawl before walk, walk before run, and all that... I think I *MIGHT* be
safe claiming that I'm at the "toddling" stage right now! :)
> The second thing - and the actual answer to your problem - is that
> you've named the method incorrectly. I'd be marginally surprised if
> you're not getting a message emitted when you run that says the object
> isn't responding correctly.
Nope... No compile/link messages, no runtime messages, no nothing - Just
silently failing to perform as expected.
Of course, now that I think about it a bit, it's not particularly
surprising that nothing shows up - the NSTableView code is looking for a
routine with the right name. My routine is named wrong. So it's as if my
code doesn't exist at all. Which makes me think that NSTableView is
silently falling back to some default (probably nothing but a stub)
method that satisfies the requirements, but doesn't actually DO anything.
> The method signature is:
>
> - (id)tableView:(NSTableView *)aTableView
> objectValueForTableColumn:(NSTableColumn *)aTableColumn
> row:(NSInteger)rowIndex
>
> Note "objectValueForTableColumn."
> ^^^^^
>
> G
That entire routine is lifted almost verbatim (except for my changing
the variable name they used from I-forget-what-it-was to "itemList" to
match what I already had going on in the project) from the CocoaDev
site. Either they've got a buggy example up, the API has changed since
they posted it, or I somehow managed to mangle it during the copy/paste.
One way or the other, it looks like it's borked.
Let's see what happens when I twiddle it...
Cha-CHING! That was indeed the problem!
I've now got a populated, properly behaving table showing up! Hooray!
Thanks yet again!
--
Don Bruder - dakidd@[EMAIL PROTECTED]
- If your "From:" address isn't on my
whitelist,
or the subject of the message doesn't contain the exact text
"PopperAndShadow"
somewhere, any message sent to this address will go in the garbage without
my
ever knowing it arrived. Sorry... <http://www.sonic.net/~dakidd>
for more
info


|