Lisp HUG Maillist Archive

Deliver subclasses of appKit classes

Hi list,

I'm trying to deliver a "pure Cocoa application" in which all the UI classes
(controllers and views) are defined with "define-objc-class".

I launch the objective-c runtime with ensure-objc-initialized in the
³init-function² as explained in the doc. At this moment, all the compiled
objective-c classes and methods declared in my codes seems to be ³linked²
with the runtime. But after this procedure all the classes inherited from
appKit classes (NSView, NSControl, and so on) are inexistent in the system
when the controllers inherited from NSObject work normally.

For instance, supposing that MyView is a class which inherit from NSView,
calling this form after ensure-objc-initialized in the init-function return
nil :
(ignore-errors (invoke ³MyView² ³class²)) => NIL.
So, naturally, my UI can't start normally.

Nevertheless, when I work inside the LW environment, all my objective-c
classes and methods work correctly.

Any advice could be very helpful.

Thanks in advance and happy new year to everybody !

Denis


-------------------------------------------------------
Denis Pousseur
70 rue de Wansijn
1180 Bruxelles, Belgium

Tel : 32 (0)2 219 31 09
Email :  denis.pousseur@gmail.com
Website : http://www.denispousseur.com
-------------------------------------------------------



Re: Deliver subclasses of appKit classes

the problem was that I have to keep explicitly the names of my objective-c
classes in the image with the deliver function argument :keep-symbol.
Controllers are more used in the lisp codes, even with lisp methods, so they
are referenced, I suppose it's why it is not necessarily for them.

Sorry for the noise

Denis


Le 1/01/12 14:11, « [NOM] » <[ADRESSE]> a écrit :

> 
> Hi list,
> 
> I'm trying to deliver a "pure Cocoa application" in which all the UI classes
> (controllers and views) are defined with "define-objc-class".
> 
> I launch the objective-c runtime with ensure-objc-initialized in the
> ³init-function² as explained in the doc. At this moment, all the compiled
> objective-c classes and methods declared in my codes seems to be ³linked²
> with the runtime. But after this procedure all the classes inherited from
> appKit classes (NSView, NSControl, and so on) are inexistent in the system
> when the controllers inherited from NSObject work normally.
> 
> For instance, supposing that MyView is a class which inherit from NSView,
> calling this form after ensure-objc-initialized in the init-function return
> nil :
> (ignore-errors (invoke ³MyView² ³class²)) => NIL.
> So, naturally, my UI can't start normally.
> 
> Nevertheless, when I work inside the LW environment, all my objective-c
> classes and methods work correctly.
> 
> Any advice could be very helpful.
> 
> Thanks in advance and happy new year to everybody !
> 
> Denis
> 
> 
> -------------------------------------------------------
> Denis Pousseur
> 70 rue de Wansijn
> 1180 Bruxelles, Belgium
> 
> Tel : 32 (0)2 219 31 09
> Email :  denis.pousseur@gmail.com
> Website : http://www.denispousseur.com
> -------------------------------------------------------
> 
> 

-------------------------------------------------------
Denis Pousseur
70 rue de Wansijn
1180 Bruxelles, Belgium

Tel : 32 (0)2 219 31 09
Email :  denis.pousseur@gmail.com
Website : http://www.denispousseur.com
-------------------------------------------------------



Re: Deliver subclasses of appKit classes

Hi Denis,

Yes, that's correct.  To make it more modular, you can keep the symbol on the
plist of some other symbol.

E.g. we do this for a few helper classes in CAPI:

(objc:define-objc-class lw-slider ()
    ()
  (:objc-class-name "LWSlider")
  (:objc-superclass-name "NSSlider"))

(setf (get 'slider-representation 'owner-class) 'lw-slider)

In this case, the code for slider-representation is the only thing that makes
the LWSlider object, so it is the best place to retain it (i.e. only if
slider-representation is retained).

-- 
Martin Simmons
LispWorks Ltd
http://www.lispworks.com/




>>>>> On Sun, 01 Jan 2012 17:57:47 +0100, Denis Pousseur said:
> 
> the problem was that I have to keep explicitly the names of my objective-c
> classes in the image with the deliver function argument :keep-symbol.
> Controllers are more used in the lisp codes, even with lisp methods, so they
> are referenced, I suppose it's why it is not necessarily for them.
> 
> Sorry for the noise
> 
> Denis
> 
> 
> Le 1/01/12 14:11, « [NOM] » <[ADRESSE]> a écrit :
> 
> > 
> > Hi list,
> > 
> > I'm trying to deliver a "pure Cocoa application" in which all the UI classes
> > (controllers and views) are defined with "define-objc-class".
> > 
> > I launch the objective-c runtime with ensure-objc-initialized in the
> > ³init-function² as explained in the doc. At this moment, all the compiled
> > objective-c classes and methods declared in my codes seems to be ³linked²
> > with the runtime. But after this procedure all the classes inherited from
> > appKit classes (NSView, NSControl, and so on) are inexistent in the system
> > when the controllers inherited from NSObject work normally.
> > 
> > For instance, supposing that MyView is a class which inherit from NSView,
> > calling this form after ensure-objc-initialized in the init-function return
> > nil :
> > (ignore-errors (invoke ³MyView² ³class²)) => NIL.
> > So, naturally, my UI can't start normally.
> > 
> > Nevertheless, when I work inside the LW environment, all my objective-c
> > classes and methods work correctly.
> > 
> > Any advice could be very helpful.
> > 
> > Thanks in advance and happy new year to everybody !
> > 
> > Denis
> > 
> > 
> > -------------------------------------------------------
> > Denis Pousseur
> > 70 rue de Wansijn
> > 1180 Bruxelles, Belgium
> > 
> > Tel : 32 (0)2 219 31 09
> > Email :  denis.pousseur@gmail.com
> > Website : http://www.denispousseur.com
> > -------------------------------------------------------
> > 
> > 
> 
> -------------------------------------------------------
> Denis Pousseur
> 70 rue de Wansijn
> 1180 Bruxelles, Belgium
> 
> Tel : 32 (0)2 219 31 09
> Email :  denis.pousseur@gmail.com
> Website : http://www.denispousseur.com
> -------------------------------------------------------
> 
> 


Re: Deliver subclasses of appKit classes

Add 'lw-slider to the plist of 'slider-representation (which is the name of
a referenced lisp class ?) ensures that lw-slider will also be referenced.
Is it correct ?

Thanks

Denis


Le 3/01/12 14:40, « [NOM] » <[ADRESSE]> a écrit :

> 
> Hi Denis,
> 
> Yes, that's correct.  To make it more modular, you can keep the symbol on the
> plist of some other symbol.
> 
> E.g. we do this for a few helper classes in CAPI:
> 
> (objc:define-objc-class lw-slider ()
>     ()
>   (:objc-class-name "LWSlider")
>   (:objc-superclass-name "NSSlider"))
> 
> (setf (get 'slider-representation 'owner-class) 'lw-slider)
> 
> In this case, the code for slider-representation is the only thing that makes
> the LWSlider object, so it is the best place to retain it (i.e. only if
> slider-representation is retained).

-------------------------------------------------------
Denis Pousseur
70 rue de Wansijn
1180 Bruxelles, Belgium

Tel : 32 (0)2 219 31 09
Email :  denis.pousseur@gmail.com
Website : http://www.denispousseur.com
-------------------------------------------------------



Re: Deliver subclasses of appKit classes

Yes, that's correct.

-- 
Martin Simmons
LispWorks Ltd
http://www.lispworks.com/


>>>>> On Wed, 04 Jan 2012 11:06:08 +0100, Denis Pousseur said:
> 
> Add 'lw-slider to the plist of 'slider-representation (which is the name of
> a referenced lisp class ?) ensures that lw-slider will also be referenced.
> Is it correct ?
> 
> Thanks
> 
> Denis
> 
> 
> Le 3/01/12 14:40, « [NOM] » <[ADRESSE]> a écrit :
> 
> > 
> > Hi Denis,
> > 
> > Yes, that's correct.  To make it more modular, you can keep the symbol on the
> > plist of some other symbol.
> > 
> > E.g. we do this for a few helper classes in CAPI:
> > 
> > (objc:define-objc-class lw-slider ()
> >     ()
> >   (:objc-class-name "LWSlider")
> >   (:objc-superclass-name "NSSlider"))
> > 
> > (setf (get 'slider-representation 'owner-class) 'lw-slider)
> > 
> > In this case, the code for slider-representation is the only thing that makes
> > the LWSlider object, so it is the best place to retain it (i.e. only if
> > slider-representation is retained).
> 
> -------------------------------------------------------
> Denis Pousseur
> 70 rue de Wansijn
> 1180 Bruxelles, Belgium
> 
> Tel : 32 (0)2 219 31 09
> Email :  denis.pousseur@gmail.com
> Website : http://www.denispousseur.com
> -------------------------------------------------------
> 
> 


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