Re: Some event ideas...

Bryan Bulten <[email protected]>
Newsgroups gmane.comp.lib.wxwindows.wxnet
Message-ID <20040506194512.47245ab7@goliath>
> Now, when you call AddCommandListener like this
> 
> AddCommandListener(Event.wxEVT_COMMAND_BUTTON_CLICKED, ID, value,
> this);

In what cases would the last argument not be 'this'?

> it also adds a reference of the calling object to the arraylist
> listeners.
> 
> When an event calls back MarshalEvent, it tries to find equal objects
> in the list and calls all! delegates, not only the last added one.

Yes, it calls all delegates, but does not check the event type for which
they are registered.

I'm also not sure if that modification would help during this situation:

  button.Clicked = new EventHandler(OnClicked1);
  EVT_BUTTON(-1, new EventHandler(OnClicked2));

Since the array of listeners are completely separate, the event would be
handled by the last handler only.  So in this case, even with he event
type checked, it would not work.

I think that there may need to be a static hash of listeners, and that
MarshalEvent needs to be passed an event type.  The listeners could then
be indexed by the event type, and looked up based on the event ID. 
(Writing something to do this now....).

Either that, or I'm completely missing the point of your code :-)

-- 
Bryan Bulten
http://www.bulten.ca/
http://wxnet.sourceforge.net/
signature.asc (application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFAms4K32WFWIzmzHgRAloPAJ0YWOOtg9Pr8WHSfNPQfqso9oZ8MgCdFDva
KOKTu8IeffGalHT+SNV7x38=
=DyDp
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.