Hi Geoffrey

> If I have a class 'Foo' (containing the function 'Wabble'), which loads
> another class 'Bar', is it possible a function within 'Bar' to execute the
> 'Wabble' function within the calling class 'Foo'?

Your first problem is that you are talking about classes without thinking about 
instances of those classes (objects).

Am I to take it that 'Wabble' is the method that creates and shows the view?

What you also need to consider is how you are going to get the address book 
data into the editing view. The easier way is to connect the controls on the 
form to properties of an object, using the bindings mechanism provided by Cocoa.

You need something like this:

@interface DataClass : NSObject
{
  // fields to hold data
}

@property NSString *name;

@property NSString *addressLine1;

…

- (void) showView;

@end

@implementation 

- (void) showView
{
  DataViewController *controller = [[DataViewController alloc] 
initWithData:self];

  ...
}

@end


@interface DataViewController : NSObject
{
  @private
    DataClass *dataProvider;
}

- (DataViewController *) initWithData:(DataClass *)data;

…

@end

@implementation DataViewController

- (DataViewController *) initWithData:(DataClass *)data
{
  self = [super init…];

  if (self)
  {
    dataProvider = data;
  }

  return self;
}

@end

Then you can bind the controls from the view to the properties of the DataClass 
instance that are available on the dataProvider field in the DataViewController 
class.

Joanna

--
Joanna Carter
Carter Consulting

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to