Re: Why is a button in a window not redrawn when I change its state?

2011-07-05 Thread Ulf Dunkel
Hi Jens. 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? That should work; in

Re: Why is a button in a window not redrawn when I change its state?

2011-07-05 Thread Ulf Dunkel
PS: I am quite sure that there is no official API for what I am doing here, so I fear there's no other nice way of checking if helpd has been launched. I could get rid of this all if I'd cover the relevant button in a sheet which isn't visible all the time, but I'd like to keep it in the main

Why is a button in a window not redrawn when I change its state?

2011-07-04 Thread 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,

Re: Why is a button in a window not redrawn when I change its state?

2011-07-04 Thread 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? 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

Re: Why is a button in a window not redrawn when I change its state?

2011-07-04 Thread Ulf Dunkel
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

Re: Why is a button in a window not redrawn when I change its state?

2011-07-04 Thread Jens Alfke
On Jul 4, 2011, at 8:07 AM, Ulf Dunkel wrote: 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

Re: Why is a button in a window not redrawn when I change its state?

2011-07-04 Thread Jens Alfke
On Jul 4, 2011, at 10:48 AM, Ulf Dunkel wrote: 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. It’s OK to call -setEnabled: during a button action method. I’ve done it a lot.