Custom event without EventObject class

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • P

    Custom event without EventObject class

    Hello,
    I need to use events in MIDP2.0, where EventObject class does not
    exist. I have built a custom event WITHOUT using EventObject (see code
    below: //Initially //Final) and, apparently, it has the same behaviour
    as the same one extending this class. My question is:
    Is it possible to build a custom event without extending EventObject
    that has the same behaviour as one which extends class EventObject?
    What am I missing?

    //public class MyEvent extends EventObject {//Initialy
    public class MyEvent {
    Object _source; //Final
    private MyEvent _myEvent;

    public MyEvent( Object source, MyEvent myEvent ) {
    //super( source );//Initially, but can´t do this now
    _source=source; // now
    _myEvent = myEvent;
    }
    public Object getSource(){ // This method was not here before, but
    it is now
    return _source;
    }

    Thank you,
    P
  • hiwa

    #2
    Re: Custom event without EventObject class

    tortcam@hotmail .com (P) wrote in message news:<f45e0989. 0401260921.1d1d [email protected] ogle.com>...[color=blue]
    > Hello,
    > I need to use events in MIDP2.0, where EventObject class does not
    > exist. I have built a custom event WITHOUT using EventObject (see code
    > below: //Initially //Final) and, apparently, it has the same behaviour
    > as the same one extending this class. My question is:
    > Is it possible to build a custom event without extending EventObject
    > that has the same behaviour as one which extends class EventObject?
    > What am I missing?
    >
    > //public class MyEvent extends EventObject {//Initialy
    > public class MyEvent {
    > Object _source; //Final
    > private MyEvent _myEvent;
    >
    > public MyEvent( Object source, MyEvent myEvent ) {
    > //super( source );//Initially, but can´t do this now
    > _source=source; // now
    > _myEvent = myEvent;
    > }
    > public Object getSource(){ // This method was not here before, but
    > it is now
    > return _source;
    > }
    >
    > Thank you,
    > P[/color]

    No problem if you implement your own event firing/listening framework from scratch.

    BTW[color=blue]
    > public MyEvent( Object source, MyEvent myEvent ) {[/color]
    ^^^^^^^^^^^^^^^
    What is this?

    Comment

    • P

      #3
      Re: Custom event without EventObject class

      Thank you very much for your help. Sorry for the constructor, I typed
      it wrong, it shouldn´t be
      public MyEvent( Object source, MyEvent myEvent )
      but
      public MyEvent( Object source, MyValue myValue)

      Then, what is the difference between using EventObject or not?
      Thanks again,
      P
      [color=blue]
      >
      > No problem if you implement your own event firing/listening framework from scratch.
      >
      > BTW[color=green]
      > > public MyEvent( Object source, MyEvent myEvent ) {[/color]
      > ^^^^^^^^^^^^^^^
      > What is this?[/color]

      Comment

      Working...