hello,
Je n'arrive pas à intercepter un évènement clavier dans mon application :
1) J'ai ce problème uniquement sur Linux (Sur windows ça fonctionne très bien)
2) J'ai ce problème seulement depuis que j'ai téléchargé la version 2.8.7
Voici mon code simplifié (.h):
.cpp :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 class myFrameMain : public wxFrame { public: myFrameMain(); private: myGLCanvas *glCanvas; }; class myGLCanvas : public wxGLCanvas { public: myGLCanvas(myFrameMain *, int *); private: wxGLContext *glContext; void onKeyDown(wxKeyEvent &); DECLARE_EVENT_TABLE() };
Voila j'espère ne pas avoir oublié de code qui pourrait servir à résoudre le problème, autrement demandé moi, merci d'avance
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26 myFrameMain::myFrameMain() : wxFrame(NULL, -1, "Title", wxPoint(-1, -1), wxSize(800,600), wxDEFAULT_FRAME_STYLE|wxSTAY_ON_TOP) { int attribsList[] = {WX_GL_RGBA, WX_GL_MIN_RED, 1, WX_GL_MIN_GREEN, 1, WX_GL_MIN_BLUE, 1, WX_GL_MIN_ALPHA, 1, WX_GL_STENCIL_SIZE, 1, WX_GL_DEPTH_SIZE, 1, WX_GL_DOUBLEBUFFER, 0}; glCanvas = new myGLCanvas(this, attribsList); wxBoxSizer *sizer = new wxBoxSizer(wxHORIZONTAL); sizer->Add(glCanvas, 1, wxALL|wxEXPAND, 0); SetSizer(sizer); } myGLCanvas::myGLCanvas(myFrameMain *parent, int *attribsList) : wxGLCanvas(parent, -1, attribsList, wxPoint(0,0)), glContext(new wxGLContext(this)) { //... } void myGLCanvas::onKeyDown(wxKeyEvent &event) { //ne passe jamais ici !!!!!! } BEGIN_EVENT_TABLE(myGLCanvas, wxGLCanvas) EVT_KEY_DOWN(myGLCanvas::onKeyDown) END_EVENT_TABLE()
Partager