Lisp HUG Maillist Archive

Native Cocoa sample code

Folks,

Does anyone have sample code that shows how to set up a native Cocoa  
app without using CAPI?

Particularly, I'm interested in the loading of NIB files and the like.

     Thanks, Joel

--
http://wagerlabs.com/uptick




Re: Native Cocoa sample code

On Aug 10, 2005, at Wed, Aug 10, 8:38 51 AM, Joel Reymont wrote:

> Folks,
>
> Does anyone have sample code that shows how to set up a native  
> Cocoa app without using CAPI?
>
> Particularly, I'm interested in the loading of NIB files and the like.

I was interested in the same thing. The nib loading example that  
comes with lispworks, area-calculator, does so via a CAPI interface -  
a little CAPI window with a button causes the area-calculator nib to  
be loaded - not at all mac-like. I like using the lispworks IDE, but  
I don't want to use CAPI for the Mac GUI so I've explored doing  
standard Cocoa stuff from within lispworks.

I've modified area-calculator in two ways:

1. It now loads the nib in the normal Cocoa fashion, bypassing CAPI   
and being careful to call all Cocoa GUI stuff with  
performSelectorOnMainThread:withObject:waitUntilDone.
2. It adds the whiz-bang feature of a button which when pushed causes  
the window title to be changed to a random entry in /usr/share/dict/ 
words.
I did this mostly to see how to properly do Cocoa memory management  
from lispworks - that is, how to avoid console messages of the form  
"just leaking" ;^)

here's area-calculator-new and the modified nib. Both should probably  
live in:
/Applications/LispWorks 4.4.5/Library/lib/4-4-0-0/examples/objc/area- 
calculator/
that is, the example folder for the original example.


regards,
Ralph

Raffael Cavallaro, Ph.D.
raffaelcavallaro@mac.com

Updated at: 2020-12-10 08:51 UTC