Re: Why is a button in a window not redrawn when I change its state?
Re: Why is a button in a window not redrawn when I change its state?
- Subject: Re: Why is a button in a window not redrawn when I change its state?
- From: Alexander Spohr <email@hidden>
- Date: Mon, 04 Jul 2011 17:58:19 +0200
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?
Am 04.07.2011 um 17:07 schrieb Ulf Dunkel:
> 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
_______________________________________________
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