Re: NSTextField refreshes are wacky.
Re: NSTextField refreshes are wacky.
- Subject: Re: NSTextField refreshes are wacky.
- From: Jonathan Feinberg <email@hidden>
- Date: Tue, 12 Mar 2002 07:49:45 -0500
At 11:05 AM +0100 3/12/02, Markus Hitter wrote:
Am Dienstag den, 12. Mdrz 2002, um 09:03, schrieb email@hidden:
You don't say so, but it sounds to me like you have somehow
changed the background of the textfield to not draw, or to draw in
a color that is transparent. In this case, you need to make sure
that -isOpaque is returning NO for your now non-opaque textfield.
As for Johnathan's original question, he probably simply messed
something up like he accidently duplicated the text field in IB or
so. There are tons of examples where he can look at, including the
CurrencyConverter Tutorial.
I have not changed the background of the text field; it's vanilla. I
did not duplicate the text field.
The problem seems to be related to threads. I have since hacked it
up to use NSNotifications from the worker thread to change the status
field in the main thread. This worked in all but one case, and I was
able to move that status field change into the main thread. I found
it disheartening that the problem occurred intermittently, but it
seems to be fine now.
For those who might be interested, the pattern is
IBOutlet NSTextField *textStatus;
- (void)awakeFromNib
{
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(statusNotification:)
name:@"SetStatus" object:nil];
}
- (void)setStatusIndirect:(NSString *)msg
{
[[NSNotificationCenter defaultCenter]
postNotificationName:@"SetStatus" object:msg];
}
- (void)statusNotification:(NSNotification *)n
{
[self setStatus:[n object]];
}
- (void)setStatus:(NSString *)msg
{
[textStatus setStringValue:msg];
[textStatus setNeedsDisplay];
[[textStatus window] displayIfNeeded];
}
- (void)workerThread:(id)arg
{
[self setStatusIndirect:@"Hello from the worker thread."];
}
--
Jonathan Feinberg email@hidden Inwood, NY, NY
http://MrFeinberg.com/
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.