
Untitled
By: a guest on
Aug 8th, 2012 | syntax:
None | size: 0.85 KB | hits: 5 | expires: Never
Access child in customized wxPanel
class MyPanel : public wxPanel
{
public:
MyPanel(wxWindow* parent) : wxPanel(parent){}
void OnMouseMove(wxMouseEvent& event);
private:
DECLAER_EVENT_TABLE()
};
class mainFrame : public wxFrame
{
...
private:
...
MyPanel* myPanel;
...
wxStaticText* StaticText1;
...
};
class mainFrame : public wxFrame
{
friend class MyPanel;
...
};
class MyPanel : public wxPanel
{
public:
MyPanel(wxWindow* parent) : wxPanel(parent){}
void OnMouseMove(wxMouseEvent& event) { if (StaticText1) { /* do something */ } ;
void SetStaticText1(wxStaticText* txt) { StaticText1 = txt;}
private:
DECLAER_EVENT_TABLE()
wxStaticText* StaticText1;
};