From 797f345b374cfb96e3741d41436a27e720aeb030 Mon Sep 17 00:00:00 2001 From: Jeena Paradies Date: Sat, 29 May 2010 16:53:06 +0200 Subject: [PATCH] added red color to negative counter --- English.lproj/MyDocument.xib | 2 +- MyDocument.m | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/English.lproj/MyDocument.xib b/English.lproj/MyDocument.xib index 489f89f..fd79165 100644 --- a/English.lproj/MyDocument.xib +++ b/English.lproj/MyDocument.xib @@ -90,7 +90,7 @@ 268 - {{244, 2}, {38, 17}} + {{257, 2}, {38, 17}} YES diff --git a/MyDocument.m b/MyDocument.m index 1c2a74b..d1c6362 100644 --- a/MyDocument.m +++ b/MyDocument.m @@ -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]]; + } }