Thank you for this hint, Alexander. I wasn't aware that I was still
inside the action and that the poor button couldn't do then what I asked
it to do.
I was quite sure that using -setNeedsDisplay:YES would trigger some
auto-redraw stuff somewhen later in the application.
- - - - -
Am 04.07.2011 17:58, schrieb Alexander Spohr:
Your Button has to draw itself after it called its action.
You try to change state while you are still in the action.
Did you try to performSelector after 0.0?
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?
_______________________________________________
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to arch...@mail-archive.com