mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 07:10:47 +00:00
Many little fixes for editing.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@5175 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
5b4e34a94e
commit
8e587afba5
1 changed files with 12 additions and 17 deletions
|
@ -505,6 +505,8 @@ static NSColor *shadowCol;
|
||||||
|
|
||||||
[textObject setFont: [self font]];
|
[textObject setFont: [self font]];
|
||||||
[textObject setAlignment: [self alignment]];
|
[textObject setAlignment: [self alignment]];
|
||||||
|
[textObject setEditable: [self isEditable]];
|
||||||
|
[textObject setSelectable: [self isSelectable]];
|
||||||
return textObject;
|
return textObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -518,33 +520,25 @@ static NSColor *shadowCol;
|
||||||
(cell_type != NSTextCellType))
|
(cell_type != NSTextCellType))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
textObject = [self setUpFieldEditorAttributes: textObject];
|
|
||||||
[textObject setDelegate: anObject];
|
[textObject setDelegate: anObject];
|
||||||
[textObject setFrame: aRect];
|
[textObject setFrame: [self drawingRectForBounds: aRect]];
|
||||||
[textObject setText: [self stringValue]];
|
[textObject setText: [self stringValue]];
|
||||||
[controlView addSubview:textObject];
|
[controlView addSubview: textObject];
|
||||||
|
[[controlView window] makeFirstResponder: textObject];
|
||||||
|
// Attention: if you see crashes, they are likely to come
|
||||||
|
// from the following message. Fix NSText.
|
||||||
[textObject display];
|
[textObject display];
|
||||||
|
|
||||||
[[controlView window] makeFirstResponder: textObject];
|
|
||||||
|
|
||||||
if ([theEvent type] == NSLeftMouseDown)
|
if ([theEvent type] == NSLeftMouseDown)
|
||||||
[textObject mouseDown:theEvent];
|
[textObject mouseDown: theEvent];
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* 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
|
- (void) endEditing: (NSText*)textObject
|
||||||
{
|
{
|
||||||
[textObject setDelegate: nil];
|
[textObject setDelegate: nil];
|
||||||
[textObject retain];
|
|
||||||
[textObject removeFromSuperview];
|
[textObject removeFromSuperview];
|
||||||
[self setStringValue: [textObject text]];
|
|
||||||
[textObject setString: @""];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Check, what exactly this method is supposed to do?
|
|
||||||
- (void) selectWithFrame: (NSRect)aRect
|
- (void) selectWithFrame: (NSRect)aRect
|
||||||
inView: (NSView *)controlView
|
inView: (NSView *)controlView
|
||||||
editor: (NSText *)textObject
|
editor: (NSText *)textObject
|
||||||
|
@ -556,13 +550,14 @@ static NSColor *shadowCol;
|
||||||
(cell_type != NSTextCellType))
|
(cell_type != NSTextCellType))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
textObject = [self setUpFieldEditorAttributes: textObject];
|
[textObject setFrame: [self drawingRectForBounds: aRect]];
|
||||||
[textObject setFrame: aRect];
|
|
||||||
[textObject setText: [self stringValue]];
|
[textObject setText: [self stringValue]];
|
||||||
[textObject setDelegate: anObject];
|
[textObject setDelegate: anObject];
|
||||||
[textObject setSelectedRange: NSMakeRange (selStart, selLength)];
|
|
||||||
[controlView addSubview: textObject];
|
[controlView addSubview: textObject];
|
||||||
|
[textObject setSelectedRange: NSMakeRange (selStart, selLength)];
|
||||||
[[controlView window] makeFirstResponder: textObject];
|
[[controlView window] makeFirstResponder: textObject];
|
||||||
|
// Attention: if you see crashes, they are likely to come
|
||||||
|
// from the following message. Fix NSText.
|
||||||
[textObject display];
|
[textObject display];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue