blob: 7c5aac3d1624fdaf102b48f6e8531057bd6885f0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
//
// LabelField.m
// TikZiT
//
// Created by Aleks Kissinger on 20/04/2011.
// Copyright 2011 __MyCompanyName__. All rights reserved.
//
#import "MultiField.h"
@implementation MultiField
- (void)textDidChange:(NSNotification *)notification {
[super textDidChange:notification];
[self setMulti:NO];
}
- (void)setMulti:(BOOL)m {
multi = m;
if (multi) {
[self setTextColor:[NSColor grayColor]];
[self setStringValue:@"multiple values"];
}
}
- (BOOL)multi { return multi; }
- (BOOL)becomeFirstResponder {
[super becomeFirstResponder];
if ([self multi]) {
[self setTextColor:[NSColor blackColor]];
[self setStringValue:@""];
}
return YES;
}
//- (BOOL)textShouldBeginEditing:(NSText *)textObject {
// [super textShouldBeginEditing:textObject];
// NSLog(@"about to type");
// return YES;
//}
//- (void)textDidEndEditing:(NSNotification *)obj {
// [super textDidEndEditing:obj];
//
// NSLog(@"focus lost");
// if ([self multi]) {
// [self setMulti:YES];
// }
//}
@end
|