• 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: Do bindings "pay attention" to visibility of control?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Do bindings "pay attention" to visibility of control?


  • Subject: Re: Do bindings "pay attention" to visibility of control?
  • From: Ricky Sharp <email@hidden>
  • Date: Mon, 5 Dec 2005 16:03:30 -0600


On Dec 5, 2005, at 2:20 PM, Andrei Tchijov wrote:

For example, in my application I have Tabless NSTabView with each tab holding "details" view for different kind of object from "master" list of objects. Obviously, only one tab is visible at a time. And more importantly, only bindings from currently visible tab "make sense" for currently selected object from "master" list. Will bindings try to keep fields from "invisible" tabs up to date or not?

On Dec 5, 2005, at 1:27 PM, Daniel Jalkut wrote:

If you think about how bindings work, it would be very difficult for them to avoid updating UI items when they were hidden. The problem is this: if you don't update it now (when the value has actually changed), when do you update it? It would be a shame to have a bunch of controls off-screen and then when they're made visible they either no longer have valid values or all have to manually update from the model.

Since the "pushing to the UI" component is based on key-value observing, there's really no other time to be notified of the change than when the change occurs. If you wanted to avoid this for some reason I suppose you could manually unbind all the controls while they are hidden and then rebind them when they become visible.

I wouldn't avoid it. I use tabless tabviews quite a bit and it's nice to have them all up-to-date when they are brought into view. I have found no performance hits at all. One thing I do though is keep my setters very lightweight. Beyond setting the value, they at most just trip flags (e.g. setNeedsDisplay:, setNeedsCreateCachedImage:). The drawXXX method is where the expensive operations occur (e.g. recreating a cached image). But those will be NOP if the view is hidden.

If you find that your setters are doing very expensive operations, you may want to consider postponing the work until a later point if possible. And, only perform the work when you're visible.

___________________________________________________________
Ricky A. Sharp mailto:email@hidden
Instant Interactive(tm) http://www.instantinteractive.com

_______________________________________________
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: 
 >Do bindings "pay attention" to visibility of control? (From: Andrei Tchijov <email@hidden>)
 >Re: Do bindings "pay attention" to visibility of control? (From: Daniel Jalkut <email@hidden>)

  • Prev by Date: Scroller partially visible in NSView
  • Next by Date: +[NSData dataWithContentsOfURL:] leaks memory?
  • Previous by thread: Re: Do bindings "pay attention" to visibility of control?
  • Next by thread: Re: Do bindings "pay attention" to visibility of control?
  • Index(es):
    • Date
    • Thread