Re: Another FilteringController question for mmalc
Re: Another FilteringController question for mmalc
- Subject: Re: Another FilteringController question for mmalc
- From: J Nozzi <email@hidden>
- Date: Fri, 17 Sep 2004 11:13:03 -0400
Sorry ...
This might be a bit better. It first checks the current selection.
Then it maintains that selection if it appears in the filtered list,
else it selects the first object in the list.
Note: This will *not* be sufficient if you allow multiple selection.
You'll need to allow for an array of selectedObjects, etc. but I don't
need all that, so I leave the rest to you. ;-)
- (void)search:(id)sender
{
// Obtain current selection
id selObj = [self selection];
[self setSearchString:[sender stringValue]];
[self rearrangeObjects];
if ([[self arrangedObjects] containsObject:selObj])
[self setSelectedObjects:[NSArray arrayWithObjects:selObj,
nil]];
else
[self setSelectionIndex:0];
}
- J
On Sep 17, 2004, at 10:56 AM, J Nozzi wrote:
Never mind. ;-) It always helps to write out your problem and pose
your question ... a short time after that you seem to come up with an
answer of your own accord. Maybe I need to just hold off posting a
question right away ... I might just answer it. ;-)
The answer might be a hack, but it certainly works beautifully. In
mmalc's example, I modified the following method to include a
conditional setSelectedIndex and it works fine:
- (void)search:(id)sender
{
[self setSearchString:[sender stringValue]];
[self rearrangeObjects];
// Added the following to fix selection problem
if ([[self arrangedObjects] count] == 1)
[self setSelectionIndex:0];
}
- J
On Sep 17, 2004, at 10:10 AM, J Nozzi wrote:
List / mmalc:
The Filtering Controller example on mmalc's Bindings page works
well for filtering, however, I'm faced with a little side-effect that
until now has stayed at the bottom of my list of issues to resolve
(as I'm very early in this app's development). I wanted to get some
suggestions for the best way of approaching a solution without the
half-baked, ugly hack I'm likely to come up with to brutishly force
the update. ;-)
The Problem:
I have a tableview that does not allow an empty selection with a
textview to hold an entry's contents. When I search and there is only
one result, it appears to be stuck. I create three 'entries' (Test 1,
Test 2, and Test 3), and put in the 'contents' all "1 1 1 1" for test
1, "2 2 2 2" for test 2, etc. If I have "test 3" selected and search
for "1", the textview goes blank, "test 1" is selected in the
tableview, and clicking it doesn't bring up its contents in the
textview.
Any ideas?
- J
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
email@hidden
This email sent to email@hidden
_______________________________________________
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