Deprecation warnings on += delegates' operators in ver3.2.0

jauthu

22-12-2012 12:39:35

I use gcc 4.6.3 in linux with next flags: "-std=c++0x -Wall -Wextra -pedantic -Wno-switch"

All files out of my project's source tree compiles with -isystem so I see no warnings not about my code.

Still I get next warnings on linking stage:


/home/mvk/projects/dev/rg/src/AppStates/OptionsGui.hpp: In constructor 'SimpleNumericSettingHandler::SimpleNumericSettingHandler(Setting&, const string&)':
/home/mvk/projects/dev/rg/src/AppStates/OptionsGui.hpp:107:76: warning: 'void MyGUI::EventPair<EventObsolete, Event>::operator+=(T*) [with T = MyGUI::delegates::IDelegate1<MyGUI::Widget*>, EventObsolete = MyGUI::delegates::CMultiDelegate1<MyGUI::Widget*>, Event = MyGUI::delegates::CMultiDelegate1<MyGUI::EditBox*>]' is deprecated (declared at /usr/include/MYGUI/MyGUI_EventPair.h:52) [-Wdeprecated-declarations]
/home/mvk/projects/dev/rg/src/AppStates/OptionsGui.hpp:109:74: warning: 'void MyGUI::EventPair<EventObsolete, Event>::operator+=(T*) [with T = MyGUI::delegates::IDelegate1<MyGUI::Widget*>, EventObsolete = MyGUI::delegates::CMultiDelegate1<MyGUI::Widget*>, Event = MyGUI::delegates::CMultiDelegate1<MyGUI::EditBox*>]' is deprecated (declared at /usr/include/MYGUI/MyGUI_EventPair.h:52) [-Wdeprecated-declarations]
/home/mvk/projects/dev/rg/src/AppStates/OptionsGui.hpp: In destructor 'virtual SimpleNumericSettingHandler::~SimpleNumericSettingHandler()':
/home/mvk/projects/dev/rg/src/AppStates/OptionsGui.hpp:114:76: warning: 'void MyGUI::EventPair<EventObsolete, Event>::operator-=(T*) [with T = MyGUI::delegates::IDelegate1<MyGUI::Widget*>, EventObsolete = MyGUI::delegates::CMultiDelegate1<MyGUI::Widget*>, Event = MyGUI::delegates::CMultiDelegate1<MyGUI::EditBox*>]' is deprecated (declared at /usr/include/MYGUI/MyGUI_EventPair.h:66) [-Wdeprecated-declarations]
/home/mvk/projects/dev/rg/src/AppStates/OptionsGui.hpp:116:81: warning: 'void MyGUI::EventPair<EventObsolete, Event>::operator-=(T*) [with T = MyGUI::delegates::IDelegate1<MyGUI::Widget*>, EventObsolete = MyGUI::delegates::CMultiDelegate1<MyGUI::Widget*>, Event = MyGUI::delegates::CMultiDelegate1<MyGUI::EditBox*>]' is deprecated (declared at /usr/include/MYGUI/MyGUI_EventPair.h:66) [-Wdeprecated-declarations]



4 warnings total. Here is the code that caused it (I filtered out all unnecessery things and commented problem lines):

SomeClass::SomeClass () {
this->editbox = MyGUI::Gui::getInstance().createWidget<MyGUI::EditBox>
("EditBox",
MyGUI::IntCoord(20, 20, 400, 400),
MyGUI::Align::Center,
"Overlapped",
"SomeName"))

this->editbox->setText("Some Text");

// Warning 1:
this->editbox->eventEditSelectAccept +=
MyGUI::newDelegate(this, &SimpleNumericSettingHandler::onTextSubmitted);

// Warning 2:
this->editbox->eventEditTextChange +=
MyGUI::newDelegate(this, &SimpleNumericSettingHandler::onTextChanged);
}

SomeClass::~SomeClass () {
// Warning 3:
this->editbox->eventEditSelectAccept -=
MyGUI::newDelegate(this, &SimpleNumericSettingHandler::onTextSubmitted);

// Warning 4:
this->editbox->eventEditTextChange -=
MyGUI::newDelegate(this, &SimpleNumericSettingHandler::onTextChanged);
}

void SomeClass::onTextSubmitted (MyGUI::WidgetPtr _sender) {
(void) _sender;
this->editbox->setTextColour(MyGUI::Colour(0, 0, 0));
}

void SomeClass::onTextChanged (MyGUI::WidgetPtr _sender) {
(void) _sender;
this->editbox->setTextColour(MyGUI::Colour(1, 0, 0));
}


How should I use delegates with MyGUI::EditBox properly? I use the same way to add delegates to other widgets' events and all goes fine.
Or is it just wrong behavior due to gcc's template things and will be fixed in the future? (I tried to look into /usr/include/MYGUI/MyGUI_EventPair.h and TextBox's headers but couldn't find any solution).

Thanks.

Altren

22-12-2012 13:45:50

Old interface wasvoid method(MyGUI::Widget* _sender)
New interface is void method(MyGUI::EditBox* _sender)
You can read about proper interface in comment near eventEditSelectAccept declaration.

We kept old delegate interface, and it work, but produce warning.

jauthu

26-12-2012 01:02:01

Thanks. That fixed the problem. Not sure that I could figure it out by myself. That template magic as long as delegate stuff is not that simple for me for now. :)

Thanks again for that quick and comprehensive answer.