[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Notification once a minute - for a clock...

From: Sašo Kiselkov
Subject: Re: Notification once a minute - for a clock...
Date: Sun, 27 Nov 2005 14:01:27 +0100
User-agent: Internet Messaging Program (IMP) 3.2.5

Quoting Jiva DeVoe <address@hidden>:

> 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
> 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];


reply via email to

[Prev in Thread] Current Thread [Next in Thread]