addEventHandler problem

rodrigofarias77

02-08-2007 18:48:27

I am getting the compile error 'QuickGUI::Widget::addEventHandler' : function does not take 3 arguments in the following line of code:

button->addEventHandler(Widget::QGUI_EVENT_MOUSE_BUTTON_UP, &App::handler, this);

Do you have any suggestion?

Regards
Rodrigo

kungfoomasta

02-08-2007 22:25:13

Check QuickGUIWidget.h to see if the function "addEventHandler" takes 3 arguments.. (which it should)

What version are you using? That error message doesn't really make any sense.. If the library compiles correctly, that means it is already using that function call with 3 parameters. For example, look at QuickGUIWindow.cpp, in the constructor.

thecaptain

03-08-2007 03:53:30

I actually had the same problem for a while, but after rebuilding a couple times, the problem went away. If a compiler were a TV or something, I'd say hit it a couple times, but since you can't, you just have to jiggle some things around in the code :D

The problem does go away eventually though!

rodrigofarias77

03-08-2007 16:41:59

KungFooMasta, I am using the version 0.9.5 v2 of QuickGUI (over the version 0.9.5), on Visual Studio 2005 SP2. It seems it compiled correctly. The addEventHandler on QuickGUIWidget.h is overloaded to accept 2 or 3 arguments. As thecaptain reported, it may be a configuration error on my IDE, as the problem disappears sometimes.

thecaptain, I have tried to compile several times but it is not still working. Do you remember if you had changed something on your project properties in order to get rid of that compile error?

Regards
Rodrigo

kungfoomasta

04-08-2007 00:04:21

I don't know what the problem could be.. all I can suggest is cleaning the library and then building it again. :(

Odd that the library compiles correctly and your app doesn't, considering the Window constructor creates a TitleBar, and adds event handlers to the TitleBar's Close Button.

rodrigofarias77

06-08-2007 23:09:15

Folks, the problem was on my code... After a lot of tries, when I removed all CEGUI references, a compile error showed my mistake. App::handler still had CEGUI arguments... Everything is working now.

Thank you
Rodrigo

kungfoomasta

08-08-2007 19:04:14

I actually ran into this myself just now, and it was really confusing. My conclusion is that Visual Studio is producing an incorrect error message. Whenever you see the error message saying the function does not take 3 arguements, make sure the function you are referencing returns bool, and takes const EventArgs&. This should solve your problem every time. I made a NOTE: remark in the addEventHandler function.

ToeNails

13-08-2009 05:01:49

Sorry to necropost, but I'm running into this exact same error.

All my code seems to be perfectly fine (copy and past for the most part) I've even tried moving things around.

Even rebuilt my solution like 3 times, and still no go.

(QuickGui editor and playpen compile fine....)

Any idea?

kungfoomasta

15-08-2009 12:21:23

Sorry for the late response, I'm on vacation with no internet access.

You need to have the right signature, you can follow this tutorial and it will show you how to register event handlers.