confusion over member variables/functions...

Rory Walsh rorywalsh at ear.ie
Fri Nov 3 03:34:49 PST 2006


Hi everyone. I'm sure this has more to do with plain old C++ than 
wxWidgets but I thought I would ask here anyway. I'm getting confused 
about what I can and can't do in terms of classes and accessing 
different members of a class. I have a main class, my frame class, which 
contains lots of GUI controls I need in my application. I've also 
derived a new class, wxLoopStation, from the MDIChildFrame base class.

I create an object of this class in one of my main frame class member
functions and all goes fine, my MDIChildFrame derived class appears on 
screen. The problem is when I try to access a member function of 
wxLoopStation I keep getting a crash, the program simply hangs there? 
Any ideas? Here is some pseudo code from my app:

//wxLooperFrame is my main class....
void wxLooperFrame::CreateChildFrame()
{
//create a new child frame...
  loopStation=new wxLoopStation((wxMDIParentFrame*)this, -1, "Loop1",
wxPoint(20, 20), wxSize(215, 255));
//create a text box in new child frame
  loopStation->freqText = new wxTextCtrl(panel, -1, "1",wxPoint(140,
24), wxSize(40, 20), wxTE_READONLY);

}

void wxLooperFrame::ButtonClick()
{
//read text from loopStation's text control
wxMessageBox(loopStation->freqText->GetValue());
}

Whenever loopStation's GetValue() method is called I get a crash. Any 
ideas?

Rory.




More information about the wx-users mailing list