• 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
Notifying NSBrowser of changed contents
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Notifying NSBrowser of changed contents


  • Subject: Notifying NSBrowser of changed contents
  • From: Nicholas Shanks <email@hidden>
  • Date: Sun, 20 Feb 2005 14:51:04 +0000

Hi there. I have an NSBrowser whose backing data changes in another thread, and I want to notify the browser that it might have to update its display. With NSTableView I can call -noteNumberOfRowsChanged, but NSBrowser has no such equivalent -noteNumberOfRowsChangedForColumn: or -noteNumberOfChildrenChangedForItem: methods. I therefore figure I'll need to subclass and implement it myself.

My situation is such that only new data will be appended to the end of a column (I'm trying to load a very slowly received [from the internet] data set asynchronously into the browser). Thus I need some way of saying to the browser "<item> now has more children, if <item> is in your selection path, please update your scroll bars, and display any new cells you may need to". Matrix cells the browser has already created will not need to be flushed, only appended to. This is where the current -loadColumn: method fails, since it causes the browser to be visibly flushed, reloaded, scroll all the way to the bottom, then scrolls back up to the selected cell! This obviously looks very bad, when all I want is for the scroll knob to get a bit shorter, or to display the new cells if there is still room.

So my questions for the list are thus:

1) Has anyone already implemented something like this and could send me the code for doing so?
2) Would anyone care to write something that could implement this for me? (worth a try :-)
3) Could anyone point me in the right direction for implementing it myself?
i.e. what would the subclass have to do? Here's my current thinking:
- determine if the update refers to anything in the selection path (always true for the -noteNumberOfRowsChangedForColumn: method)
- call the delegate methods -browser:numberOfRowsInColumn or -browser:createRowsForColumn:inMatrix: to find the new number of rows
- get the matrix and append the requisite number of rows
- resize the matrix's frame (is this automatic?) and hack about with the enclosing scroll view until it looks like it's doing the right thing
- draw any cells if we still have empty space to do it in (would I need to call -browser:willDisplayCell:atRow:column: and do some other things, or will -loadedCellAtRow:column: load and draw the cell for me?)
- was there anything I missed off?


- Nick.

_______________________________________________
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


  • Prev by Date: Re: combining strings with floats into an NSTextView
  • Next by Date: Re: Problem with a framework with a nib
  • Previous by thread: Localizing hierarchical plist information?
  • Next by thread: Launch a Cocoa application from CoreFoundation with arguments
  • Index(es):
    • Date
    • Thread