multiple delegates for one event?

Thrakbad

21-06-2010 09:55:25

Is it possible to set multiple delegate functions for one event? Or do I have to wrap them into one single function?

Thrakbad

25-06-2010 09:53:04

Can I take the silence for a no? :wink:

AshMcConnell

25-06-2010 12:07:04

No I don't think you can as you need to assign directly to the delegate function rather than add to a list

All the best,
Ash

Altren

25-06-2010 12:47:25

Oh, I thought I answered to that.

Most events are delegates, so you can't assign more than one event to it. There are only few multi-delegates used in MyGUI like
Gui::eventFrameStart
InputManager::eventChangeMouseFocus
InputManager::eventChangeKeyFocus
They can be used next way
// add
MyGUI::Gui::getInstance().eventFrameStart += MyGUI::newDelegate(this, &State::notifyFrameEvent);
// remove
MyGUI::Gui::getInstance().eventFrameStart -= MyGUI::newDelegate(this, &State::notifyFrameEvent);