[SOLVED] buttonThrowers in c++?

Hi,
Any hints on how to implement in C++, the python :

base.buttonThrowers[0].node().setButtonDownEvent('button_down')
#accept all keys
self.accept('button_down', self.buttons,['pressed'])
NodePath btnp = window->get_button_thrower();
ButtonThrower *bt = DCAST(ButtonThrower, btnp.node());
bt->set_button_down_event("button_down");
framework.get_event_handler().add_hook("button_down", event_button_down, this);

David

Thank you David,
Actually I tried something like this, but the issue I meet is how to get the key code that triggered the event?

void event_button_down (const Event* evenmt, void* data) {
 std::cout << "key name: " << evenmt->get_name() << "\n";
}

since here for instance I’m only getting “button_down” as a descriptor and obviously the key code is the info seeked.
Should evenmt or one of its parameters be DCASTed to some type (?) in order to get the keycode?

Yes, the “key code” is the string name of the key, passed as the first parameter, similar to the Python form.

To get the string from the first parameter, use:

event->get_parameter(0).get_string_value();

David

done, thank you again!