views:

271

answers:

2

Hi I am trying to create a table-view programatically using a cocoa lisp bridge called clozure CL. Now I doubt many people are familiar with this package so I will not go into specifics of my code but I am getting some very strange errors when I try to call addSubview to add my tableView to my window. I have initialized it using InitWithFrame. I am wondering what are the minimum the steps required to programatically setup and add a tableView to a window. I cannot use the interface builder.

Any links to code that shows how to this in objective c would be very helpful I can do the conversions to lisp.

+3  A: 

1 - Create a scroll view (because the table's size will vary).

2 - Create the table view.

3 - Create columns (set their titles, data cells and identifiers if you're using data source protocol).

4 - Add the columns to the table.

5 - Bind the columns to an appropriate controller (if using bindings) or set the table's -dataSource to a controller that implements NSTableDataSource protocol (if using NSTableDataSource protocol).

6 - Add the scroll view to the appropriate superview with appropriate autoresize settings.

I'm sure I'm missing some configuration steps, but this is basically what you need.

Joshua Nozzi
5.5 - You also need to add the tableview to the scrollview with e.g. [scrollview setDocumentView:tableview].
Erik Elmgren
Quite right. :-)
Joshua Nozzi
+2  A: 

Here is a recently published Cocoa/Clozure Common Lisp tutorial:

http://tclispers.org/news/cocoalisp-tutorial

Don't be afraid to show Lisp code; I know that there are several regular Lispers here.

Svante