Hi Tomas,

> >>    (java Label 'addMouseListener
> >>       (interface "java.awt.event.MouseListener"
> >>          'mouseClicked '((Ev) (setq Dir (if (= 1 Dir) 12 1)))
> >>          'mouseEntered nil
> >>          'mouseExited nil
> >>          'mousePressed nil
> >>          'mouseReleased nil ) )
> >> 
> >> have all those nil cases?  Is that necessary?
> >
> > I would prefer if it were not necessary. But an interface like
> > MouseListener requires the implementation of all methods. I think I
> > got a runtime error if I didn't supply all methods.
> >
> > Do you have an idea? On the other hand I don't worry too much if I
> > simply supply empty methods (this could be encapsulated in a
> > function).
> There are two thing you could do:
> Why don't you simply default to 'nil' in your proxy dispatcher if the
> method is not specified?  Or something like that.

Then ErsatzLisp would need to know for the Interface which methods are
needed, taking additional reflection time.

Instead I would perhaps define convenience functions in the GUI

   (de mouseListener Args
      (list "java.awt.event.MouseListener"
         'mouseClicked (get Funs 'mouseClicked)
         'mouseEntered (get Funs 'mouseEntered)
         'mouseExited (get Funs 'mouseExited)
         'mousePressed (get Funs 'mousePressed)
         'mouseReleased (get Funs 'mouseReleased) ) )

This is what I meant by "this could be encapsulated in a function".

Then call it like

      (mouseClicked (Ev) (foo))
      (mouseReleased (Ev) (bar)) )

- Alex
UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe

Reply via email to