So I have a class MyPanel inherited from wxPanel:
class MyPanel : public wxPanel
{
public:
MyPanel(wxWindow* parent) : wxPanel(parent){}
void OnMouseMove(wxMouseEvent& event);
private:
DECLAER_EVENT_TABLE()
};
and another main wxframe defined below:
class mainFrame : public wxFrame
{
...
private:
...
MyPanel* myPanel;
...
wxStaticText* StaticText1;
...
};
StaticText1 eventually will be assigned as the child of myPanel. So I want to update mouse cursor's coordinates in the method OnMouseMove()
I am wondering how I can access to StaticText1 and update stuff.
Use friend declaration, like this:
class mainFrame : public wxFrame
{
friend class MyPanel;
...
};