• 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: Newbie Q - responding appropriately to buttons
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Newbie Q - responding appropriately to buttons


  • Subject: Re: Newbie Q - responding appropriately to buttons
  • From: Henry McGilton <email@hidden>
  • Date: Wed, 18 Jun 2003 13:41:25 -0700

On Wednesday, June 18, 2003, at 01:16 PM, Robert Palmer Jr wrote:

This may seem obvious to some, but I'm still trying to figure out the _correct_ way to do things.

I just finished writing the first full pass of an application and I have everything basically working. The issue is one of the buttons. I have a search button that triggers the code to search for items (of a particular type) on the local network. This search takes about 5 seconds.

Currently, I have the button action configured and in the action handler method, I actually call the search function, which is a _blocking_ function. This results in the search button not changing colors (to indicate it was pressed) until AFTER the search is complete. I don't mind the fact that the application is held up for 5 seconds - it only does this one thing and the user can't do anything else while a search is in progress anyway.

My thoughts on a solution: probably the MOST correct would be to put the search function in a separate thread and the search button would simply call a function that started that thread. This would also allow me to put up a progress dialog.

Is there an alternative method using notifications or messages? Is there a way to have the button post a notification so that the search doesn't happen immediately, but after the next run loop execution. This way the button would flash. Of course, once the search actually started, the application would still be held up for 5 seconds, but again, for the moment, that's ok.


Possibly one of the NSObject methods of the
performSelector:withObject:afterDelay:
family might be useful in this context.

Best Wishes,
........ Henry


===============================+============================
Henry McGilton, Boulevardier | Trilithon Software
Objective-C/Java Composer | Seroia Research
-------------------------------+----------------------------
mailto:email@hidden | http://www.trilithon.com
|
===============================+============================
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Newbie Q - responding appropriately to buttons (From: Robert Palmer Jr <email@hidden>)

  • Prev by Date: JPEG from NSBitMapImageRep Mangled
  • Next by Date: Re: Newbie Q - responding appropriately to buttons
  • Previous by thread: Newbie Q - responding appropriately to buttons
  • Next by thread: Re: Newbie Q - responding appropriately to buttons
  • Index(es):
    • Date
    • Thread