Re: setTextColor, display string, then set it back not working
Re: setTextColor, display string, then set it back not working
- Subject: Re: setTextColor, display string, then set it back not working
- From: Walker Argendeli <email@hidden>
- Date: Tue, 6 Jan 2009 23:10:12 -0500
I can't believe I didn't realize that. Right now, I've got it set so
that the last thing that block of code does is change the color to
red. The code is an if block, so if the value isn't zero-length, it
will continue on. Then, I have it change the color bak to black
again, successfully keeping it red until a valid value is entered.
Further question though, other than kicking off a timer, is there a
way I could get the text to flash on the screen red for a second, or
is a timer the only way to accomplish that?
On Jan 6, 2009, at 10:53 PM, Graham Cox wrote:
On 7 Jan 2009, at 7:34 am, Walker Argendeli wrote:
But if I uncomment the last line again, countDisplay remains black,
displaying the message in black instead of red. What's going on?
// Set display text to red for zero-length warning...
[countDisplay setTextColor:[NSColor redColor]];
[countDisplay setStringValue:@"***Please enter a string***"];
// ...and back again
[countDisplay setTextColor:[NSColor blackColor]];
You do realise that the time between setting red and then back to
black is measured in nanoseconds, right? But even if your computer
had a clock speed of 1Hz, you wouldn't see the change anyway because
the screen is only updated at the end of each event cycle.
You need to arrange for the reset to black to occur after a useful
time delay, maybe by kicking off a timer and then setting black in
its callback method.
--Graham
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden