Re: Filtering tableview problems
Re: Filtering tableview problems
- Subject: Re: Filtering tableview problems
- From: Scott Little <email@hidden>
- Date: Mon, 23 Feb 2004 20:15:00 +0100
This is what I did the other day to solve that problem, though it
seemed to be a bit of a hack. I would be interested to know if anyone
has a more elegant solution. The search: selector is set as the action
for the field and is called when the value of the NSSearchField is
changed (either continuously or when the user hits Enter depending on
the settings of the field). This seemed to work in both cases, though I
haven't done a lot of testing on it :-p
- (void)search:(id)sender {
[self rearrangeObjects];
if ([sender isKindOfClass:[NSSearchField class]]) {
NSWindow *myWindow = [NSApp keyWindow];
NSText *myEditor = [myWindow fieldEditor:NO forObject:sender];
NSRange savedRange = [myEditor selectedRange];
[myWindow makeFirstResponder:sender];
[myEditor setSelectedRange:savedRange];
}
}
Actually this also answers more clearly the question posed about
getting the selection of a text field.
Scott Little
Netonomy Empowering your customers through self-service
Tel: +336 14 48 65 20
Email: email@hidden
On 23 Feb, 2004, at 19:37, Francisco Tolmasky wrote:
This question has already been posted once, but with no avail. I'm
having trouble filtering an nstableview with bindings. What happens
is that the search field loses focus when the table view rearranges
itself. Does anyone know a solution to this?
Also, does anyone know where i can get this example which now seems to
be down:
http://homepage.mac.com/mmalc/CocoaExamples/FilteringController.zip
Francisco Tolmasky
email@hidden
http://users.adelphia.net/~ftolmasky
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.