Parameters passed to the connect function are wrong!
« on: 20 January 2015, 15:54:34 »
Quote
error: static assertion failed: Parameters passed to the connect function are wrong!
static_assert(!std::is_same<Func, Func>::value, "Parameters passed to the connect function are wrong!");

I have using this code:
Code: [Select]
buttonCreate->connect("Pressed", std::bind(&Handler::createNewMap, this), editBoxWidth, editBoxHeight);

void Handler::createNewMap(tgui::EditBox::Ptr editBoxWidth, tgui::EditBox::Ptr editBoxHeight)
{ ... }

*

texus

  • *****
  • 1161
    • View Profile
    • Texus's Blog
Re: Parameters passed to the connect function are wrong!
« Reply #1 on: 21 January 2015, 02:31:50 »
The code u used is indeed wrong. Technically the editBoxWidth and editBoxHeight should be part of the std::bind call because you want to bind 3 parameters (this pointer, width and height) and not just one.

But unlike the old bindCallback function, the connect function will take care of binding for you. It is enough to write the following:
Code: [Select]
buttonCreate->connect("Pressed", &Handler::createNewMap, this, editBoxWidth, editBoxHeight);
The connect function will "detect" that all parameters of the createNewMap function are given and will bind these parameters.

Re: Parameters passed to the connect function are wrong!
« Reply #2 on: 21 January 2015, 13:23:13 »
Thanks, worked :D