Re: Bindings Basics: selections
Re: Bindings Basics: selections
- Subject: Re: Bindings Basics: selections
- From: Niko Matsakis <email@hidden>
- Date: Wed, 1 Jun 2005 00:01:48 +0200
Okay, so I read these links that you posted. I also took a "bindings
only" example (the Mailboxes program from cocoabuilder.com that is
used to introduce bindings) to eliminate core data and stripped it
down to the bare essentials. No dice.
As a reminder, I am trying to have the selection from a NSPopUpButton
determine what is displayed in a NSTableView.
I still cannot get this to work. I have posted the project at http://
smallcultfollowing.com/MailDemo.zip.
Basically all I have is an NSPopUpButton whose content is drawn from
one ArrayController. Then there is a second ArrayController who is
set to be "selection.emails" from the first ArrayController, and an
NSTableView which draws its content from arrangedObjects of the
second ArrayController.
The symptom is that changing the selection in the NSPopUpButton does
not cause the NSTableView to refresh its data. Any clue how to fix
this?
I still feel that there is some very basic confusion on my part about
what it means to make a binding. It seems to be some kind of both an
input and output relationship, and quasi-magical about what kinds of
messages it sends, etc. I guess I expect more clarity and division:
i.e., I would expect to have to set up a binding for where to draw
content from, then another binding where the NSPopUpButton has some
sort of output which connects to an input on the NSArrayController in
order to specify the current selection for the NSArrayController.
But instead they all seem to come at once.
Also, in the manual it mentions for table views certain bindings for
the table as a whole are made automatically based on the first
column's bindings, but I don't see that in IB. Do those bindings
that happen at runtime?
As a bonus question: Is there any way to turn on debugging output for
bindings to get a clearer picture of what's going on "under the hood?"
thanks in advance,
Niko
On May 30, 2005, at 1:39 AM, mmalcolm crawford wrote:
On May 29, 2005, at 2:50 PM, Niko Matsakis wrote:
I do not understand how a selection gets set in Core Bindings. [...]
I have seen several examples that have an NSTableView, and use the
selection in the table view to populate some other fields. This
is the default interface generated by Option-Dragging a Data Model
into IB, for example. Unfortunately, I just don't get how it works.
In this case, the "detail" fields which are being populated (that
contain the details of the current entry), always refer to the
array controller and use a path like "selection.xxx".
To understand what bindings are and how they work, read:
<http://developer.apple.com/documentation/Cocoa/Conceptual/
CocoaBindings/Concepts/WhatAreBindings.html>
then
<http://developer.apple.com/documentation/Cocoa/Conceptual/
CocoaBindings/Concepts/HowDoBindingsWork.html>
It's not clear to me how selection is set; [...] It must be that
the NSTableView automatically adjusts the selection of its Content
Set Array Controller through some means, because I can't find
where it's being asked to.
If you simply bind the value of a table column, the content,
selectionIndexes, and sortDescriptors bindings are established
automatically for you. When the user makes a selection in a view,
the view messages the controller to update the selection
automatically.
if there are multiple NSTableViews using a given controller, for
example, whose selection is set? (or is the answer "don't do that")
Don't do that.
Does it work differently if it is a NSPopUpButton that is reading
from the array controller? Does it not set the selection? Can I
make it do so?
It works in fundamentally the same way.
mmalc
_______________________________________________
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
_______________________________________________
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