[Openmcl-devel] Problems loading .nib file in CCL 1.2-rc1

mikel evins mevins at mac.com
Wed Apr 30 06:09:49 PDT 2008


On Apr 29, 2008, at 10:01 PM, Gary Byers wrote:
>
>
> On Wed, 30 Apr 2008, Tord Romstad wrote:
>
>> I'm trying to do some Cocoa Lisp programming again, after a couple of
>> years of painful exile in Objective-C on a 32-bit Intel Mac.  To my
>> frustration, I discover that I no longer know how to load a .nib file
>> from the application bundle.  I've tried a very simple task: To  
>> load a
>> .nib file containing a single empty window and nothing else.  Here is
>> the procedure I have followed:
>>
>> 1. Open Interface Builder.  I choose "File -> New", and pick the
>> "Window" template to make my window.
>>
>> 2. Set the class of "File's Owner" to "NSWindowController", and
>> connect the "window" outlet to the window created in step 1.
>>
>> 3. Save the file, in the format "Interface Builder Cocoa Document  
>> (NIB 3.x)".
>>
>> 4. Start CCL, and do the following:
>>
>> Welcome to Clozure Common Lisp Version 1.2-r9226-RC1  (DarwinX8664)!
>> ? (require "BUILD-APPLICATION")
>> "BUILD-APPLICATION"
>> ("builder-utilities" "BUILD-APPLICATION")
>> ? (ccl::build-application :name "Test" :directory
>> "/Users/tord/Desktop" :nibfiles
>> '("/Users/tord/Documents/Programs/Lisp/Test/Test.nib"))
>>
>> 5. Double-click the Test.app icon on the desktop.
>>
>> 6. In the listener window, I type:
>>
>> ? (setf *wc* (#/initWithWindowNibName: (#/alloc (find-class
>> 'ns:ns-window-controller))
>>                                      #@"Test.nib"))
>
> Does it work if the ".nib" is left off the nib name argument ?

I tested the exact sequence above, and got the exact results that Tord  
reported. Then I tried

(setf *wc* (#/initWithWindowNibName: (#/alloc (find-class
'ns:ns-window-controller))
                                       #@"Test"))

  (#/window *wc*)

...and the window appeared as expected. The difference, as Gary  
suggests, was to use the name #@"Test" instead of #@"Test.nib".

Note that Apple's docs at
http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/NSWindowController_Class/Reference/Reference.html#/ 
/apple_ref/occ/instm/NSWindowController/initWithWindowNibName:

  do say to omit the ".nib" in the windowNibName parammeter.

--me





More information about the Openmcl-devel mailing list