• 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: simple AppKit / multithreading question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: simple AppKit / multithreading question


  • Subject: Re: simple AppKit / multithreading question
  • From: "Corey O'Connor" <email@hidden>
  • Date: Sat, 12 Mar 2005 12:02:36 -0800

On Sat, 12 Mar 2005 11:24:08 -0800, Dennis C. De Mars
<email@hidden> wrote:
> On Mar 11, 2005, at 5:44 AM, Aurélien Hugelé wrote:
>
> > Hi list !
> >
> > my app is heavily multithreaded, and needs to modify the GUI. I know
> > that the interface mods needs to be done in the main thread.
> > Its is very convenient to use performSelectorInMainThread: for my
> > secondary threads... but still, i have a question :
> >
> > most of my threads need to modify the enabled/disabled state or the
> > hidden/shown state of my widgets. I use setEnabled:YES/NO or
> > setHidden:YES/NO
> >
> > but i can not use  performSelectorInMainThread:withObject: here! the
> > argument of this method must be NSObjects ... not BOOL !
> >

I think adding a controller layer between your background thread and
the UI would help you. Instead of having the background thread
directly manipulate the UI, have the background thread call
performSelectorOnMainThread: on a controller object. Then have the
controller object do all the UI manipulations. Multiple
performSelectorOnMainThread's for changing several UI elements at once
would be reduced to a single call on the controller object. Reducing
programmer effort and, most likely, reduce system resources. This
would also abstract your background thread from a specific UI;
simplifying UI changes in the future.

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

This email sent to email@hidden

References: 
 >simple AppKit / multithreading question (From: Aurélien Hugelé <email@hidden>)
 >Re: simple AppKit / multithreading question (From: "Dennis C. De Mars" <email@hidden>)

  • Prev by Date: Re: simple AppKit / multithreading question
  • Next by Date: Re: Could not connect the action to target of class
  • Previous by thread: Re: simple AppKit / multithreading question
  • Next by thread: NSPopUpButtonCell in custom NSTableColumn in NSTableView - not changing value
  • Index(es):
    • Date
    • Thread