Thu Feb 18 1999 Felipe A. Rodriguez <farz@mindspring.com>

* NSView.m display: fix for display bug in buttons example
	* NSCell.m endEditing: fix for display bug in buttons example
	* NSTextField.m textShouldEndEditing: The changes to these three classes
    fix a display bug visible in the buttons example when the top text field is
    selected for editing and then asked to resign when the user clicks on say
    the bottom text field.  This causes a rect encompassing both views to be
    invalidated and displayed.  Beyond being inefficient this also causes a
    display glitch given the current drawing methodology.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@3755 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Felipe A. Rodriguez 1999-02-18 10:46:39 +00:00
parent c064034852
commit ee210229a6
4 changed files with 54 additions and 18 deletions

View file

@ -1,3 +1,14 @@
Thu Feb 18 1999 Felipe A. Rodriguez <farz@mindspring.com>
* NSView.m display: fix for display bug in buttons example
* NSCell.m endEditing: fix for display bug in buttons example
* NSTextField.m textShouldEndEditing: The changes to these three classes
fix a display bug visible in the buttons example when the top text field is
selected for editing and then asked to resign when the user clicks on say
the bottom text field. This causes a rect encompassing both views to be
invalidated and displayed. Beyond being inefficient this also causes a
display glitch given the current drawing methodology.
Wed Feb 17 11:50:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
* Source/NSView.m: Tidyup - visibleRect is empty if we have no window.

View file

@ -339,16 +339,12 @@ NSString* number_string = [[NSNumber numberWithInt:anInt] stringValue];
[controlView unlockFocus];
}
/*
* editing is complete, remove the text obj acting as the field
* editor from window's view heirarchy, set our contents from it
*/
- (void)endEditing:(NSText *)textObject
{
[textObject setDelegate:nil];
[textObject removeFromSuperview];
[self setStringValue: [textObject text]];
}
- (void)endEditing:(NSText *)textObject // editing is complete,
{ // remove the text obj
[textObject setDelegate:nil]; // acting as the field
[textObject removeFromSuperview]; // editor from window'
[self setStringValue: [textObject text]]; // view heirarchy, set
} // our contents from it
- (void)selectWithFrame:(NSRect)aRect
inView:(NSView *)controlView

View file

@ -384,8 +384,28 @@ id nextResponder;
- (BOOL)textShouldEndEditing:(NSText *)aTextObject // NSText(field editor)
{ // delegate method
[cell endEditing:aTextObject];
fprintf(stderr, " TextField textShouldEndEditing --- ");
if([cell isEntryAcceptable: [aTextObject text]])
{
// if([delegate respondsTo:control:textShouldEndEditing:]) // FIX ME
// {
// if(![delegate control:textShouldEndEditing:])
// {
// NSBeep();
// return NO;
// }
// else
// return YES;
// }
[cell endEditing:aTextObject];
}
else
{ // entry is not valid
NSBeep();
return NO;
}
[self display];
[window flushWindow];
return YES;
}

View file

@ -928,13 +928,22 @@ static PSMatrix *flip = nil;
return NO;
}
- (void) display
- (void)display
{
if (!window)
return;
[self displayRect: bounds];
}
if(!window) // do nothing if not in
return; // a window's heirarchy
if ([self isOpaque]) // if self is opaque
[self displayRect:bounds]; // display visible rect
else // else back up to a
{
NSView *firstOpaque = [self opaqueAncestor]; // convert rect into
NSRect rect = bounds; // coordinates of the
// first opaque view
rect = [firstOpaque convertRect:rect fromView:self];
[firstOpaque displayRect:rect];
}
}
- (void) displayIfNeeded
{