Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Making new data source rows from Cocoa



Paul:

Thank you very much for the ideas. I've been down most of those roads.

To address your points:

I want to make new data rows in Cocoa because AS is so slow. It takes a about 3 seconds to do 1,500 of those in AS. Using AS to add the data to the rows was slow, too.

I played around with implementing my own data source in Cocoa (as you suggested), but I got lost when trying to do things like click on a column header and have it change the sort column or sort order. The AS code was unable to do that with my Cooca data source. So, I believe there are things in Cocoa that you cannot do in AS, and things in AS you cannot do in Cocoa. Perhaps I gave up too soon.

So far, I have reasonable results with leaving the data source in AS, using AS to make the new data rows (suffering the delay), using Cocoa to load the data source, and then doing column selection and sorting in AS.

Jeff


At 5:34 PM -0800 12/1/03, Paul Berkowitz wrote:
On 12/1/03 1:00 PM, "Jeffrey Mattox" <email@hidden> wrote:

I'm experienced at mixing ASS with Cocoa and even Perl, but I've been
unable to figure out how to make new entries in a data source from
Cocoa. That is, I want to do this in Cocoa:

make new data row at end of the data rows of theDataSource

I'm able to access the table view and data source objects to Cocoa,
but I don't know the selector to use, as in:

call method "myCocoaRoutine:" with parameter theTableView

-(void)myCocoaRoutine:(NSTableView *)theTableView
{
id theDataSource;
dataSource = [theTableView dataSource];
[dataSource makeNewDataRow]; // <-- what is the proper selector?
...
}

My experience is that AppleScript data sources and Objective C ones don't
mix. data sources and their rows and columns are the _only_ things one can
'make new' as objects in Studio at present and, however they've been rigged
up, they don't appear to be accessible to call method. You can, however,
make your own subclasses NSObject files as custom data sources, and use call
method with them. The only reason for doing so would be to do things - for
example attributed strings in table views - that Studio data sources can't
do. in the above example, you don't (so far - I don't know what's coming
next) seem to need to do this at all. Why not just use the standard command
to 'make new data source' you quote in your first line.

If you really need a custom ObjC data source, then provide accessor methods
in the ObjC class file, and call that from Studio:

call method "myAddARow" of class "myCustomClass" with parameters
aListHere

You make your own ObjC method, or call the standard Obj methods in your
Cocoa file. That involves knowing about ObjC dictionaries, etc. which
perhaps you know already Check the NSTableDataSource protocol in the Cocoa
documentation - it's pretty good. Note that NSTableDataSource is a protocol,
not a class, of ApplicationKit, You'll find out everything you need there,
or from the Cocoa mailing list.

--
Paul Berkowitz
_______________________________________________
applescript-studio mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-studio
Do not post admin requests to the list. They will be ignored.
_______________________________________________
applescript-studio mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-studio
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: Making new data source rows from Cocoa (From: Paul Berkowitz <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.