Hi, Urhofans.
I have my Application class where I can check the events, but I would like make other class
and check new events there like buttons.
Can somebody help me?
[color=#FF0000]Suscribetoevent was not declared in this scope[/color]
Hi, Urhofans.
I have my Application class where I can check the events, but I would like make other class
and check new events there like buttons.
Can somebody help me?
[color=#FF0000]Suscribetoevent was not declared in this scope[/color]
Hi,
You probably want to make your class a subclass of Object, which has the SubscribeToEvent method.
For example, the Character class from CharacterDemo subclasses LogicComponent, so it’s also an Object.
github.com/urho3d/Urho3D/tree/m … racterDemo
urho3d.github.io/documentation/H … types.html
HTH
Thank you very much!
But… not work in my case
I only want create a
[color=#4040BF]SubscribeToEvent(button, E_RELEASED, URHO3D_HANDLER(MyNewClass, MyButtonFunction));[/color]
Ok. Now works, but I need set the new class as LogicComponent I’m not sure if this is the best solution
No, not work
void MyNewClass::Press_Switch(StringHash eventType, VariantMap& eventData)
{
text_password->SetText("HELLO");
cout << "SWITCH WORKS!" << endl;
}
When I press my switch button, the app crash. If I put the setText in othe function works fine, but if i add this
in a handler the app crash.
It is only a small bit of code, but I can say you probably have some bad C++ somewhere in that class.
The documentation and wiki can help, as well as a debugger.
To forget to register new Component classes can cause crashes.
github.com/urho3d/Urho3D/blob/m … mo.cpp#L59
Assuming the demo does not crash, you might study it for something else missed.
Thanks again!
I’ll keep trying
WORKS!!!