added red color to negative counter

This commit is contained in:
Jeena Paradies 2010-05-29 16:53:06 +02:00
parent 1e39bed3f0
commit 797f345b37
2 changed files with 8 additions and 2 deletions

View file

@ -90,7 +90,7 @@
<object class="NSTextField" id="184011745">
<reference key="NSNextResponder" ref="568628114"/>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{244, 2}, {38, 17}}</string>
<string key="NSFrame">{{257, 2}, {38, 17}}</string>
<reference key="NSSuperview" ref="568628114"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="894039108">

View file

@ -87,7 +87,13 @@
}
-(void)controlTextDidChange:(NSNotification *)aNotification {
[counter setIntValue: 140 - [[textField stringValue] length]];
NSInteger c = 140 - [[textField stringValue] length];
[counter setIntValue:c];
if(c < 0) {
[counter setTextColor:[NSColor redColor]];
} else {
[counter setTextColor:[NSColor controlTextColor]];
}
}