I wanted to create frame with window and textctrl, when user clicked on the window or the textctrl the messagebox had to appear. So I did this like that. First I put definition of the class myevt in the header file:
class myevt : public wxEvtHandler
{
public:
void Mouse(wxMouseEvent&); private:
DECLARE_EVENT_TABLE();
}; Then In my cpp file I wrote an implementation of this class
BEGIN_EVENT_TABLE(myevt, wxEvtHandler)
EVT_LEFT_DOWN(myevt::Mouse)
END_EVENT_TABLE()
void myevt::Mouse(wxMouseEvent& event)
{
wxMessageBox("dsfs", "sdfs", wxOK);
} In the constructor of the frame I created one window and textctrl and of course evt. Everything looked like below:
evt = new myevt();
w3 = new wxWindow(this, -1, wxPoint(220, 120), wxSize(100, 100),
wxSIMPLE_BORDER);
w3->PushEventHandler(evt);
t1 = new wxTextCtrl(this, -1, "cbcbxcbxcvbxcvbbxcb", wxPoint(20, 100),
wxSize(100, 100), wxTE_MULTILINE |
wxNO_FULL_REPAINT_ON_RESIZE);
t1->PushEventHandler(evt); And when I compiled this program the window was transparent, but not on the whole area. And I have no idea why, does anybody know. I use winxp, maybe on other systems this program works correctly ? |