• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Doing stuff with a HUD window
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Doing stuff with a HUD window


  • Subject: Re: Doing stuff with a HUD window
  • From: "John C. Welch" <email@hidden>
  • Date: Wed, 24 Aug 2011 09:58:06 -0400
  • Thread-topic: Doing stuff with a HUD window

Hokay, so I've got the window coming up and becoming key, the timer fires, that part of life is good. 

The problem is now, how to kill the timer. If I do nothing, every time I re-open the window, I get another timer. That's expected when I think about it. So, I tried doing notifications, but I think I'm getting the timer reference wrong. Pertinent code below:

on homeTeamTimeOut_(sender)

--homeTimeOutHud's orderFront_(me)

homeTimeOutHud's makeKeyAndOrderFront_(me)

set my homeTimeOutTime to 0

tell current application's NSWorkspace to set theWorkspace to sharedWorkspace()

set notifCenter to theWorkspace's notificationCenter()

tell notifCenter to addObserver_selector_name_object_(me,"theWindowClosed:","NSWindowWillCloseNotification",homeTimeOutHud)

set theTimeOutTimer to my NSTimer's scheduledTimerWithTimeInterval_target_selector_userInfo_repeats_(1,me,"timeOutTimerFired:","",true)

end homeTeamTimeOut_


That SEEMS to work, in that it doesn't throw errors and the timer works.

Timer code:

on timeOutTimerFired_(theTimeOutTimer)

set my homeTimeOutTime to homeTimeOutTime + 1

end timeOutTimerFired_


Window closing code:


on theWindowClosed_(notif)

my theTimeOutTimer's invalidate() --tried with and without "my", no difference noted. 

tell current application's NSWorkspace to set theWorkspace to sharedWorkspace()

set notifCenter to theWorkspace's notificationCenter()

tell notifCenter to removeObserver_name_object_(me,"NSWindowWillCloseNotification",homeTimeOutHud)

end theWindowClosed_


It's clearly not killing the timer, so I know I'm missing something basic, but no idear what.

-- 
"Try to look unimportant; they may be low on ammo."
Infantry Journal.


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
applescriptobjc-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Doing stuff with a HUD window
      • From: Shane Stanley <email@hidden>
References: 
 >Re: Doing stuff with a HUD window (From: "John C. Welch" <email@hidden>)

  • Prev by Date: Re: Doing stuff with a HUD window
  • Next by Date: Re: Doing stuff with a HUD window
  • Previous by thread: Re: Doing stuff with a HUD window
  • Next by thread: Re: Doing stuff with a HUD window
  • Index(es):
    • Date
    • Thread