My wxFrame dont take key events

I have a wxFrame and do not take key events.
Can it happens because my keyboard is an old ps2?
I am putting code...
.... i just try with usb keyboard ... same condition.
Code has problem but where? It is so simple.



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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47

class frame1 : public wxFrame 
{
	private:
	protected:
		virtual void OnKeyPress( wxKeyEvent& event ) { event.Skip(); }
	public:
		frame1( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("my frame ..."), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 1197,776 ), long style = wxDEFAULT_FRAME_STYLE|wxSTAY_ON_TOP|wxNO_BORDER|wxWANTS_CHARS );
};

frame1::frame1( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxFrame( parent, id, title, pos, size, style )
{
	this->SetSizeHints( wxDefaultSize, wxDefaultSize );
	this->Connect( wxEVT_KEY_DOWN, wxKeyEventHandler( frame1::OnKeyPress ) );
}


class frame2: public frame1
{
public:
    frame2(wxFrame *frame);
private:
    virtual void OnKeyPress( wxKeyEvent& event );
};

frame2::frame2(wxFrame *frame) : frame1(frame) {}

void frame2::OnKeyPress( wxKeyEvent& event ){ Destroy(); }


class frameApp : public wxApp
{
    public:
        virtual bool OnInit();
};

IMPLEMENT_APP(frameApp);

bool frameApp::OnInit()
{
    frame2* frame = new frame2(0L);
    frame->Show();
    return true;
}


Last edited on
I am using wxWidgets 3, Mint OS.
Topic archived. No new replies allowed.