framework.define_key problem

hello!
I’m new in this forum! I hope you help me!
I’m this code:

#include <iostream>
using namespace std;

#include <pandabase.h>
#include <pandaFramework.h>
#include <pandaSystem.h>
#include <genericAsyncTask.h>
#include <asyncTaskManager.h>
#include <panda.h>
#include <panda3d/waitInterval.h>

PandaFramework framework;

void keyEvent(const Event * e, void * data) {
	cout << "press " << e->get_name() << endl;
}

int main(int argc, char * argv[]) {
	framework.open_framework(argc, argv);
	framework.set_window_title("Test");
	framework.open_window();

	framework.define_key("w", "", &keyEvent, NULL);
	framework.define_key("a", "", &keyEvent, NULL);
	framework.define_key("s", "", &keyEvent, NULL);
	framework.define_key("d", "", &keyEvent, NULL);

	framework.main_loop();

	framework.close_framework();
	return 0;
}

I’m compiling this program and run i but when I press “w” button on the keyboard, keyEvent function is not performed.
Why?
thanks for all!!

try :

PT(WindowFramework) window = framework.open_window();	// open the window
window->enable_keyboard(); // and enable keyboard!

:smiley: