Monday, December 11, 2017

#1 2009-09-21 07:35:39 am

robdut
Member
Registered: 2009-09-02
Posts: 301

connecting two tables without datasource

hi All,

RE; my last topic about binding a checkbox to a table election- that all worked well. I was using Scott Stevenson's excellent MailDemo tutorial as a template. It really taught me a lot about bindings.

http://www.cocoadevcentral.com/articles/000080.php

I was able to get all the bindings working and even archive the whole thing. That was a cocoa app though. So I tried to import his six class files into my new ASOC app and use those as the binding mechanism for the app and run all the processing from the app delegate script. But When any of the bindings are connected I get GDB signals "SIGABRT"  and app won't launch. So I don't know how to incorporate those class files into my ASOC app and have it all mesh together.

OK. So I start over with new ASOC app and forget the cocoa files.  there are two tables, one to show a list of "sets" and the other for a list of files. I want the files list to be bound to the selection of the "Sets" table. I could do this using a datasource type connection (Craigs' booklist demo) and onSelectionChanged in the "Sets" table update the files list somehow but I was hoping to do it all with bindings as in the MailDemo app and avoid the "glue code" 

i alos need to write the whole array to file in the end so the relationships are preserved.

I can see how this works in Scott's mailDemo cocoa app but am really struggling to grasp how to do this in ASOC from the applescript side, how to set up or initialize the tables and bind them.

Sorry for the long winded query,

Rob

Offline

 

#2 2009-09-22 06:23:07 am

robdut
Member
Registered: 2009-09-02
Posts: 301

Re: connecting two tables without datasource

Hi All,

To be a bit more specific about binding my two tables together, in the OBJ-c code for the classes representing the array controller objects it seems necessary to initialize the arrays. In the Cocoa app the FileList table column's binding can refer to the specific "properties.title" in the BackupSet's array class.

In the "Backupset" class file:

Applescript:


#import "BackupSet.h"

@implementation BackupSet

- (id) init
{
if (self = [super init])
{
NSArray * keys = [NSArray arrayWithObjects: @"title", nil];
NSArray * values = [NSArray arrayWithObjects: @"NewBackupset", nil];
properties = [[NSMutableDictionary alloc] initWithObjects: values forKeys: keys];

sourcefiles = [[NSMutableArray alloc] init];
}
return self;
}

The "MYController" class file, to initialize the array which will contain the two bound tables :

Applescript:


- (id) init
{
if (self = [super init])
{
_backupsets = [[NSMutableArray alloc] init];
}
return self;
}

I can't figure out how to translate this into my ASOC script class

Applescript:

script backuplistBAppDelegate
   
   property parent : class "NSObject"
   
   -- the two properties representing the array controllers
   property BackupSet : missing value
   property FileList : missing value
   
   
--IB actions for the add and remove "sets" buttons
   on addBackupSet_(sender)
       
   end addBackupSet_
   
   on removeBackupSet_(sender)
       
   end removeBackupSet_
   
   # Application handlers, processing etc...
   
end script

Or perhaps I am overcomplicating this.

Thanks,  Rob

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)