[Openmcl-devel] How to send a message to the objc super-class ?

Gary Byers gb at clozure.com
Sun Feb 3 18:39:53 PST 2008



On Sun, 3 Feb 2008, Didier Verna wrote:

> mikel evins <mevins at mac.com> wrote:
>
>> We're working on it; in the meantime, can you use ccl::define-objc-
>> method instead of objc:defmethod?
>
>  Actually, I've now tried call-next-method, and ccl::define-objc-method
> as follows:
>
> (objc:defmethod (#/drawWithFrame:inView: :void)
>    ((self outline-cell) frame view)
>  (call-next-method frame view))
>
> (ccl::define-objc-method ((:void :draw-with-frame (:id frame)
>                           :in-view (:id view)) outline-cell)
>  (ccl::send-super :draw-with-frame frame :in-view view))
>
> Both compile and execute without any complaint, but nothing is drawn,
> which suggests to me that the actual super-method isn't executed... ?

Drawing in Cocoa is a bit different than it is in other platfforms.
The simple version is that you can draw in any execution context
that you want to, as long as it's the drawRect: method on the main
thread.  (Before calling that method, the Cocoa runtime sets
up the graphics context and state; drawing without that setup
work having been performed generally has no effect.)

<http://trac.clozure.com/openmcl/wiki/CocoaBridge>

and a few pages linked from there discuss other ways of locking focus
on a view and drawing to it from other execution contexts.




More information about the Openmcl-devel mailing list