Re: EVT_XXXX macros again
Bryan Bulten <[email protected]>
| Newsgroups | gmane.comp.lib.wxwindows.wxnet |
|---|---|
| Message-ID | <[email protected]> |
> ....
> EVT_MENU( ID_QUIT, OnQuit );
> but had no luck, since I couldn't find the parameter
> type of a method/function which I would pass as the
> second parameter. Is that possible at all?
No, since C# doesn't have function pointers. Instead, it uses a new
concept, called delegates. This short article has a pretty good
introduction to what they do, from a C/C++ perspective:
http://www.dotnetextreme.com/articles/delegates.asp
One goal, after the EVT_* macros are implemented, is to use delegates
much like how Windows Forms uses them. In this way, adding an event
handler would be much like this:
Button btn = new Button(....);
btn.ButtonHandler = new ButtonHandler(OnButtonClick);
btn.ButtonHandler += new ButtonHandler(OnButtonClick2);
This is the prefered C# way of handling events. I'm still new to the
concept, but it seems quite powerful.
I'd like to eventually implement the delegates for wx.NET, as an
alternative the the EVT_* macros, since they would be very helpful for
those coming from Windows Forms.
--
Bryan Bulten
http://opendev.ods.org/
http://wxnet.sourceforge.net/
signature.asc
(application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (GNU/Linux) iD8DBQE+pmLj32WFWIzmzHgRAovhAJsHulCaR9GeDKBm9U6hWVOAid4fngCcCuiX EOHeXX9sn6BeclHOSvb+z/E= =CAKA -----END PGP SIGNATURE-----