MyGUI 3.2: Delegate events in MultiListBox

almondega

23-04-2012 01:45:09

Hi everyone, I'm trying to set my first delegate in a MultiListBox, but I'm getting the following linker error:

BattleManager.obj : error LNK2001: unresolved external symbol "private: void __thiscall BattleManager::onMultiListKeyButtonPress(class MyGUI::Widget *,struct MyGUI::KeyCode,unsigned int)" (?onMultiListKeyButtonPress@BattleManager@@AAEXPAVWidget@MyGUI@@UKeyCode@3@I@Z)

Since the MyGUI wiki is outdated for delegate events, I searched for samples here on the forum, and did this on my project:

Header.h
class BattleManager
{
public:
BattleManager(...);
private:
void onMultiListKeyButtonPress(MyGUI::Widget* sender, MyGUI::KeyCode key, MyGUI::Char _char);
};


Header.cpp
BattleManager::BattleManager(...)
{
uiSpecialMagic->eventKeyButtonPressed += MyGUI::newDelegate(this, &BattleManager::onMultiListKeyButtonPress); // Causes linker error
}

void onMultiListKeyButtonPress(MyGUI::Widget* sender, MyGUI::KeyCode key, MyGUI::Char _char)
{
...
}


Am I missing some code or project configuration?

Thanks.

Altren

23-04-2012 10:41:56

You missed BattleManager:: before onMultiListKeyButtonPress.

almondega

23-04-2012 20:14:16

Holy #@$%# :oops: :oops:

Sorry for that, I completely didn't see that missing...

Thanks, working just fine now :wink: