[Openmcl-devel] interactive nib loading

Osei Poku osei.poku at gmail.com
Wed Jan 30 16:15:58 PST 2008

I could not even get past the first step.  This was the error

? (make-instance 'ns:ns-nib :with-nib-named #@"/Users/opoku/Work/ 
myUI.nib" :bundle +null-ptr+)
 > Error: No applicable method for args:
 >         (#<A Null Foreign Pointer> :WITH-NIB-NAMED #<NS-CONSTANT- 
STRING "/Users/opoku/Work/myUI.nib" (#x192057C0)> :BUNDLE #<A Null  
Foreign Pointer>)
(T)>, in process Listener(76).
 > Type :POP to abort, :R for a list of available restarts.
 > Type :? for other options.

On Jan 30, 2008, at 5:49 PM, R. Matthew Emerson wrote:

> On Jan 30, 2008, at 3:27 PM, Osei Poku wrote:
>> This question is likely due to my lack of familiarity with Cocoa/
>> Objective C API and/or the corresponding openmcl bridge.  But I have
>> attempted to find help in the documentation to no avail.
>> Essentially, I want to create an interface using Interface Builder
>> save it and then load it interactively at the openmcl repl.  I simply
>> do not even know which Cocoa function to use to load the nib file.
>> This is complicated by the fact that the nib file is in the wild  
>> (some
>> arbitrary path). I am going to go back and read some more about the
>> interface builder but I would appreciate some help on the  
>> programmatic
>> end.
>> The closest matches to what I want seem to be by using the NSNib or
>> NSBundle classes to load the nib file however, I am confused as to
>> what arguments to give the various instantiate function on the lisp
>> side.
> You'll probably want to use NSNib for this, since you say that your  
> nib file will be at an arbitrary location.
> See:
> http://developer.apple.com/documentation/Cocoa/Conceptual/LoadingResources/CocoaNibs/chapter_3_section_6.html
> Something like (untested, probably wrong, etc.)
> (let* ((nib (make-instance 'ns:ns-nib :with-nib-named #@"path/to/nib"
> 			   :bundle +null-ptr+))
>       (top-level-objs +null-ptr+))
>  (rlet ((p :address top-level-objs))
>    (#/instantiateNibWithOwner:topLevelObjects: nib owner p))
>  (#/release nib)
>  ;; etc., see example in docs cited above about releasing top level  
> objects
>  ...)
> Note that the nib file path needs to be an NSString, not a lisp  
> string.

More information about the Openmcl-devel mailing list