From fe64bf3e97fab4408c893501fcb9877541d5bfde Mon Sep 17 00:00:00 2001 From: Doug Simons Date: Tue, 4 Jan 2011 18:57:26 +0000 Subject: [PATCH] Fix cancel button to correctly clear the field and send action. Fix -textDidChange: to correctly send action rather than popping up the menu on each keystroke (when sendsWholeSearchString is false). git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@31833 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 8 ++++++++ Source/NSSearchFieldCell.m | 15 ++++++++++----- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2a798d1b2..cabc0d7aa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2011-01-04 Doug Simons + + * Source/NSSearchFieldCell.m: + Fix cancel button to correctly clear the field and send action. + Fix -textDidChange: to correctly send action rather than popping up + the menu on each keystroke (when sendsWholeSearchString is false). + + 2011-01-04 Wolfgang Lux * Source/tiff.m (NSTiffWrite): diff --git a/Source/NSSearchFieldCell.m b/Source/NSSearchFieldCell.m index d012be749..5a577fd2e 100644 --- a/Source/NSSearchFieldCell.m +++ b/Source/NSSearchFieldCell.m @@ -273,8 +273,8 @@ [c setEditable: NO]; [c setImagePosition: NSImageOnly]; [c setImage: [NSImage imageNamed: @"GSStop"]]; - [c setAction: @selector(delete:)]; - [c setTarget: nil]; + [c setAction: @selector(clearSearch:)]; + [c setTarget: self]; [c setKeyEquivalent: @"\e"]; [c setKeyEquivalentModifierMask: 0]; } @@ -441,10 +441,15 @@ textObject = [notification object]; // copy the current NSTextEdit string so that it can be read from the NSSearchFieldCell! [self setStringValue: [textObject string]]; - [[self searchButtonCell] performClickWithFrame: - [self searchButtonRectForBounds: [_control_view bounds]] - inView: _control_view]; + [NSApp sendAction:[self action] to:[self target] from:_control_view]; } + +- (void) clearSearch:(id)sender +{ + [self setStringValue:@""]; + [NSApp sendAction:[self action] to:[self target] from:_control_view]; +} + // // NSCoding protocol //