Re: Can't bind my array to that scrollview
Re: Can't bind my array to that scrollview
- Subject: Re: Can't bind my array to that scrollview
- From: Martin Ottenwaelter <email@hidden>
- Date: Wed, 29 Jun 2005 13:53:24 +0200
Oups, sorry, I mixed up things.
Here is how I made my NIB file :
an instance of my Query class
an NSArrayController linked to the Query class via the "content" outlet
an NSTableView whose first column is bound to "output"
And instead of displaying each item of my array on separate lines,
the first line of the table has an "(one,two,three)" string...
Martin.
Le 29 juin 05 à 13:34, Scott Anguish a écrit :
I think you have two problems
1, you say you're binding to an NSScrollView.. that just isn't
right. My guess is that you want to bind to the item IN the
scrollview (typically you click on the scrollview to select it, and
then double click on it to select the nested object (the tableview
or scrollview)
you'd need to bind the NSArrayController's contentArray to
yourModelObject's .output key path
(did you have an NSArrayController??)
then add an NSTableView, and select a column in the tableview and
bind the NSTableColumn's value binding to the arraycontroller
arrangedObjects..
On Jun 29, 2005, at 7:14 AM, email@hidden wrote:
Hi,
I am just beginning in Cocoa and I am trying to learn bindings.
I made a very simple Class named "Query" that has two instance
variables : input
(a NSNumber) and output (a NSArray). Well, here the code from
"query.m" :
@implementation Query
- (id) init {
self = [super init];
if (self != nil) {
[self setInput:[NSNumber numberWithInt:5]];
[self setOutput:[NSArray
arrayWithObjects:@"one",@"two",@"three",nil]];
}
return self;
}
- (void) setInput : (NSNumber *) theInput {
input = theInput;
}
- (void) setOutput : (NSArray *) theOutput {
output = theOutput;
}
- (NSNumber *) input {
return input;
}
- (NSArray *) output {
return output;
}
@end
I bound input to a text field, it worked ok.
I bound output to a NSScrollView and, instead of displaying "one",
"two",
"three" on a different line, it displays the following string :
"(one,two,three)" on the first line of my scroll view.
Why is that ?
Thanks for your help,
Martin.
_______________________________________________
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
--
Martin
_______________________________________________
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