wxPostEvent and derived class
Riccardo Corona
coronariccardo at gmail.com
Thu May 17 04:21:47 PDT 2007
Hi,
I've some problem to post event to father class, this is my situation:
............................................................
file A.h :
enum{
TEST =3D 100
}
BEGIN_DECLARE_EVENT_TYPES()
DECLARE_EVENT_TYPE(TESTEVT, TEST)
END_DECLARE_EVENT_TYPES()
Class A : public wxevtHandler{
public:
void OnEvent(wxEvent &event);
private:
DECLARE_EVENT_TABLE()
}
............................................................
file A.cpp:
DEFINE_EVENT_TYPE(TESTEVT)
BEGIN_EVENT_TABLE (A, wxEvtHandler)
EVT_CUSTOM(TESTEVT, -1 ,A::OnAlive)
END_EVENT_TABLE()
void A::OnAlive(wxEvent &event)
{
//Something
}
............................................................
file B.h :
Classe B: public A{
}
............................................................
Now, in other section of the code I've made :
myVar is an istance of B
.....
wxCommandEvent* ev;
ev=3Dnew wxCommandEvent(TESTEVT);
ev->SetEventType(TESTEVT);
ev->SetEventObject((wxObject*)this);
if (canale->padre=3D=3DNULL)return;
wxPostEvent((A*)myVar,*ev);
......
So, I would like to raise OnEvent of class A but seems that wxPostEvent
can't do this. I've already used it with successfull way but never in this
way.
Is that possible?
Thank's.
-- =
Riccardo Corona
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.wxwidgets.org/pipermail/wx-users/attachments/20070517/6ea=
01786/attachment.htm
More information about the wx-users
mailing list