Newbie Q - responding appropriately to buttons
Newbie Q - responding appropriately to buttons
- Subject: Newbie Q - responding appropriately to buttons
- From: Robert Palmer Jr <email@hidden>
- Date: Wed, 18 Jun 2003 16:16:36 -0400
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.
Thanks,
Robert Palmer, Jr
email@hidden
_______________________________________________
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.