[Openmcl-devel] interactive nib loading

R. Matthew Emerson rme at clozure.com
Wed Jan 30 14:49:14 PST 2008


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