Understanding/re-using MyGUI delegates system

simed

16-01-2012 11:01:48

I really like the delegates setup MyGUI has, in terms of how easy it is to put event-handlers. I need to add event-handling to my applications and I was interested about either using MyGUI's classes, or creating my own which implement similar functionality without adding a dependency on MyGUI.

However looking at the source code, I find it very confusing with so many templates and typedefs, and stranger things - not helped that VC++ intellisense seems very confused by the code!

I would welcome any thoughts on this, like "is MyGUI a good model to reuse", "how would I set up a simple event handler on my class", etc. I suppose a simple example would be I want one of my classes to allow adding no-param event handlers which take the form void func(void).


EDIT: I've figured out how to use the MyGUI delegates in my own code but the question remains - are they a good solution or should be use something like this: http://stackoverflow.com/questions/4298 ... c-delegate?

One specific question on MyGUI delegates... do they provide any way to get a return value? So for instance observers get the chance to tell an object "don't self-delete" when events get sent?