Is there a way to add an image cell column to a table outside of using IB? I’m trying FaceSpan, and I can’t figure out how to set it up in that program. In IB we can draw one into a table column, but that option does not exist in FaceSpan (as far as I can tell).
So I am asking here because I would like to know how IB sets the Image Cell (or Text Field Cell) up in Cocoa. Then maybe I can set this up myself maybe in my FS project. FS is just easier to learn on, I think, and I’ve gotten alot farther on my app using it. This is the one hurdle I have to overcome for now… why didn’t they just add the draggable option like AS Studio… grrrr…
Thanks guys,
Doug.app.newbie
Hi 
Unfortunately, to my knowledge, AS-Studio does not allow, by default, to create objects dynamically by the code.
It is perhaps possible to do that by using the Obj-C methods, but I do not control absolutely these techniques for the moment.
As for FaceSpan, I think that its possibilities are for the moment much more reduced on the matter than AS-Studio, but, there too, I am not a sufficiently expert to deliver a sure opinion.
Sorry not to better be able to help you.

Thanks, Fredo.
The learning curve for this can be pretty difficult to overcome. It’s hard to find solid info sometimes. I signed up at VTC.com and went through their AppleScript 2006 and Applescript Studio courses (about 16 hours total I think), and I learned alot, but much of this is still a total mystery. Once I hit the Cocoa wall I get in trouble. Looks like I’ll have to take the C programming course…
There must be a way to get this to work…
Hi Doug,
sorry - I have absolutely no idea what’s possible with FaceSpan and what’s not - I have never used it … but for adding a Table column with ImageCells programmatically I might give you some help.
As Fredo alredy said - it is not possible from AppleScript - you need a little Objective-C for this.
Here a first (quick&dirty) attempt:
just add a new Objective-C class file to your project and edit … .h/… .m like so:
// TableViewAdditions.h
#import <Cocoa/Cocoa.h>
@interface NSTableView (TableViewAdditions)
-(void)addColumnWithIdentifier:(NSString *)identifier width:(float)theWidth cellType:(int)cell;
@end
// TableViewAdditions.m
#import "TableViewAdditions.h"
@implementation NSTableView (TableViewAdditions)
-(void)addColumnWithIdentifier:(NSString *)identifier width:(float)theWidth cellType:(int)cell{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSTableColumn *newColumn = [[NSTableColumn alloc] initWithIdentifier:identifier];
[newColumn setWidth];
switch (cell) {
case 1:
[newColumn setDataCell:[[NSTextFieldCell alloc] init]];
break;
case 2:
[newColumn setDataCell:[[NSImageCell alloc] init]];
break;
case 3:
[newColumn setDataCell:[[NSButtonCell alloc] init]];
break;
default:
break;
}
[self addTableColumn:newColumn];
[pool release];
}
@end
now it should be possible to create new table columns from your applescript with:
tell (table view "tv" of scroll view "sv" of window "main")
set theIdentifier to "pictures"
set columnWidth to 50.0
set cellType to 2 -- 1= textfield cell, 2 = image cell, 3 = button cell
call method "addColumnWithIdentifier:width:cellType:" of it with parameters {theIdentifier, columnWidth, cellType}
end tell
D.
Nice! Thank you SO much for the guidance. I’ll try it tonight…
Doug