Code: Select all
BEGIN_EVENT_TABLE(myAuiFrame, wxFrame)
EVT_CLOSE(myAuiFrame::OnClose)
EVT_MENU(idMenuQuit, myAuiFrame::OnQuit)
EVT_MENU(idMenuNew, myAuiFrame::OnNew)
EVT_MENU(idMenuAbout, myAuiFrame::OnAbout)
EVT_MENU(OPENBEAMFILE, myAuiFrame::DisplayResults)
END_EVENT_TABLE()
BEGIN_EVENT_TABLE(myTreeCtrl, wxTreeCtrl)
...
EVT_MENU(OPENBEAMFILE, myTreeCtrl::RunBeamFile)
END_EVENT_TABLE()
void myTreeCtrl::RunBeamFile(wxCommandEvent &event)
{
BeamInput *CalcBeamFile;
CalcBeamFile = new BeamInput((wxChar*)CurrentFile.c_str());
delete CalcBeamFile;
// event.Skip(); <--- if I leave this line uncommented I get a segmentation fault and myAuiFrame does not receive event
// if I comment it out the event handling ends here
}
When the user selects "View Results" from the tree item's context menu an instance of the BeamInput class is created. Within this class a file is read and a calculation dll is called. The calculation dll creates a text file with the resulting input and output. After the file is created I need to be able to create a new panel to display the output. As far as I know, this should be done in the AuiFrame and it should be added to the AuiManager. Once the text file is on screen I need to delete the temporary file created by the dll. I have not made the AuiFrame or the AuiManager global so I can not access them from myTreeCtrl and if possible I would prefer to avoid globals.
I have set a breakpoint inside myAuiFrame::DisplayResults(wxCommandEvent& event) and have stepped through the debugger to verify that this function is never called. Have I done something wrong here? At this point I haven't even begun to create the new panel to display the text file because I can't figure out how to let the AuiFrame know that there is an output file there to be displayed.
A note about myself since I haven't posted before... I have been toying with writing simple projects with wxWidgets, off and on, for a few years now. I took a class that covered many of the basics of wxWidgets at the local community college a few years back when I was deciding which API to use when developing the project I am currently writing. At the time I was doing program development and maintenance for my company however, in the time since then, my work duties have shifted away from programming and I have unfortunately not made as much time as I should to learn the more intricate details of programming with wxWidgets. Unfortunately the devil is in the detail.