Why is a button in a window not redrawn when I change its state?
Why is a button in a window not redrawn when I change its state?
- Subject: Why is a button in a window not redrawn when I change its state?
- From: Ulf Dunkel <email@hidden>
- Date: Mon, 04 Jul 2011 17:07:59 +0200
- Organization: invers Software & DSD.net
In my app's main window, I have a button which should kill a process
from the running system processes. (Guess what - it is helpd.)
In -awakeFromNib:, a private app delegate method -checkHelpd: checks if
some other app has already launched helpd. If so, the button will be
drawn as enabled, else disabled.
When I press the button, another private method -killHelpd: definitely
kills the process, then -checkHelpd: is used again to check whether the
button's state should be disabled or enabled. This triggers a redraw of
the window - or at least should do. But the button is not redrawn (with
its new state) until I toggle the active app from my app to say Xcode
and back to my app.
This is the method in my AppDelegate.m which should update the button:
- (void)updateKillHelpdButton
{
[killHelpdButton setEnabled:[self checkHelpd]];
[killHelpdButton setNeedsDisplay:YES];
}
Can someone please tell me what else I should do to force the redraw?
Thank you in advance,
---Ulf Dunkel
_______________________________________________
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