Well, I guess I sort of managed to get it working.
Code: Select all
class TxtEdtApp : public wxApp{
public:
virtual bool OnInit();
#ifdef __WXMAC__
virtual void MacOpenFiles(const wxArrayString & fileNames); //It is apparently not necessary to put "wxOVERRIDE" here.
#endif //WXMAC
wxString Cp;
};
But still had the problem that the TxtEdtApp::OnMacOpenFiles would not recognize the TxtEdtFrame object created in the OnInit() function.
So my solution was to just create a new frame within the MacOpenFiles() scope:
Code: Select all
#ifdef __WXMAC__
void TxtEdtApp::MacOpenFiles(const wxArrayString & fileNames ) {
TxtEdtFrame* Frame = new TxtEdtFrame(0);
Frame->Show();
SetTopWindow(Frame);
Frame->OnRunRun(fileNames[0], 2);
}
#endif
This works, but I wanted it to just use the one window. None of the things I tried for that worked:
Code: Select all
Frame->OnRunRun(fileNames[0], 2); //Use of undeclared identifier 'Frame'
TxtEdtFrame->OnRunRun(fileNames[0], 2); // Cannot use arrow operator on a type
TxtEdtFrame.OnRunRun(fileNames[0], 2); // Cannot use dot operator on a type
TxtEdtFrame::OnRunRun(fileNames[0], 2); // Call to non-static member function without object argument
// I tried various things like TxtEdtApp::TxtEdtFrame->OnRunRun(fileNames[0], 2); without any luck either.
Not a huge deal, but it would be cool if I could load a file in without having 2 window frames pop up. Any ideas how I might access the OnRunRun() function of the 1st frame created by the OnInit(), or failing that delete that frame and just use the newly created one from the MacOpenFiles()?