Quoting Jiva DeVoe <[EMAIL PROTECTED]>:

> So I'm sorta hacking on WildMenus this weekend, and have implemented
> a primitive clock in the menubar... I'm wondering what's the best way
> to get my clock to redraw once a minute?  Obviously the menu code
> itself gets linked into each application, so having 20 applications
> all launching their own little background timers to update the
> menubar clock sounds kinda cruddy.  What would be the best way to do
> this?  I imagine some kind of NSNotification but that also seems cruddy.
>
> (ps: For those who want said functionality - I have been sending
> patches to Michael Hanni, the WildMenus maintainer, so look for a
> release from him eventually.)
>
> --
> Jiva DeVoe
> http://www.devoesquared.com
> PowerCard - Intuitive Project Management for Mac OS X
>
>

This in fact isn't such a big problem. But to get the max efficiency out of it
do it like this:

// if we're not the currently displayed app this method immediately returns
- (void) invokedOnceAMinute
{
  if ([NSApp isActive])
    {
      [self updateClockDisplay];
    }
}

// update the clock's display in case it hasn't been updated in the mean time
- (void) appDidBecomeActive
{
  [self updateClockDisplay];
}

Regards
--
Saso



_______________________________________________
Gnustep-dev mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/gnustep-dev

Reply via email to