开发者

Event and the argument list error

I have a problem w开发者_高级运维ith CEGUI Library

i have a class for event ( click , keyup...etc )

class GUI_Event
{
private:
bool (*_L_Mouse_Click_DoFunction ) () ; 

protected:
bool onClick(const EventArgs &Args)
 { 
   return _L_Mouse_Click_DoFunction();
 }


public:
SetFunctionClick(bool Function ())  /// i forget ()
 { 
  _L_Mouse_Click_DoFunction = Function ;
  }

};

i have another class named button to create button and window

cass GUI_Button : public GUI_Event
{
public:
void CreateButton(//some argument) ; 
};

void GUI_Button::CreateButton(//some argument)
{
...
.
..
..

_Frame_Window->subscribeEvent ( FrameWindow::EventMouseClick , Event::Subscriber (&GUI_Window::onClick ));//error



}

now if i compile this code i get the following error

error C2064: term does not evaluate to a function taking 1 arguments c:\cegui-sdk-0.7.5-vc10\cegui\include\ceguifunctorcopyslot.h 51


Check this line,

SetFunctionClick(bool Function) { _L_Mouse_Click_DoFunction = Function ;}

Class member _L_Mouse_Click_DoFunction is a function pointer. So it can be assigned only the same type variable. The value Function is of bool type.

You can change it to,

SetFunctionClick(bool (*Function) ())
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜