mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 00:31:03 +00:00
Editing patches partly by Andreas Höschler <ahoesch@smartsoft.de>.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@25426 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
561e8d0985
commit
ddb1df7caa
5 changed files with 140 additions and 111 deletions
|
@ -376,22 +376,22 @@ static Class textFieldCellClass;
|
|||
* was in use by another control.
|
||||
*/
|
||||
if ([_window makeFirstResponder: self])
|
||||
{
|
||||
NSText *t = [_window fieldEditor: YES forObject: self];
|
||||
{
|
||||
NSText *t = [_window fieldEditor: YES forObject: self];
|
||||
|
||||
if ([t superview] != nil)
|
||||
{
|
||||
/* Can't take the field editor ... give up. */
|
||||
return;
|
||||
}
|
||||
|
||||
_text_object = [_cell setUpFieldEditorAttributes: t];
|
||||
[_cell editWithFrame: _bounds
|
||||
inView: self
|
||||
editor: _text_object
|
||||
delegate: self
|
||||
event: theEvent];
|
||||
}
|
||||
if ([t superview] != nil)
|
||||
{
|
||||
/* Can't take the field editor ... give up. */
|
||||
return;
|
||||
}
|
||||
|
||||
_text_object = [_cell setUpFieldEditorAttributes: t];
|
||||
[_cell editWithFrame: _bounds
|
||||
inView: self
|
||||
editor: _text_object
|
||||
delegate: self
|
||||
event: theEvent];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -457,39 +457,44 @@ static Class textFieldCellClass;
|
|||
{
|
||||
NSFormatter *formatter;
|
||||
NSString *string;
|
||||
BOOL validatedOK = YES;
|
||||
|
||||
formatter = [_cell formatter];
|
||||
string = AUTORELEASE ([[_text_object text] copy]);
|
||||
|
||||
if (formatter == nil)
|
||||
{
|
||||
[_cell setStringValue: string];
|
||||
}
|
||||
else
|
||||
{
|
||||
id newObjectValue;
|
||||
NSString *error;
|
||||
|
||||
if ([formatter getObjectValue: &newObjectValue
|
||||
forString: string
|
||||
errorDescription: &error] == YES)
|
||||
{
|
||||
[_cell setObjectValue: newObjectValue];
|
||||
}
|
||||
else
|
||||
{
|
||||
SEL sel = @selector(control:didFailToFormatString:errorDescription:);
|
||||
if (formatter != nil)
|
||||
{
|
||||
id newObjectValue;
|
||||
NSString *error;
|
||||
|
||||
if ([formatter getObjectValue: &newObjectValue
|
||||
forString: string
|
||||
errorDescription: &error] == YES)
|
||||
{
|
||||
[_cell setObjectValue: newObjectValue];
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
SEL sel = @selector(control:didFailToFormatString:errorDescription:);
|
||||
|
||||
if ([_delegate respondsToSelector: sel])
|
||||
{
|
||||
validatedOK = [_delegate control: self
|
||||
didFailToFormatString: string
|
||||
errorDescription: error];
|
||||
}
|
||||
else if (![string isEqualToString: @""])
|
||||
{
|
||||
validatedOK = NO;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ([_delegate respondsToSelector: sel] &&
|
||||
[_delegate control: self
|
||||
didFailToFormatString: string
|
||||
errorDescription: error] == YES)
|
||||
{
|
||||
[_cell setStringValue: string];
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
if (validatedOK)
|
||||
{
|
||||
[_cell setStringValue: string];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue