The only programmatic code is in wxTextFileFrame::OnMenuOpenSelected() of the file wxTextFileMain.cpp.
void wxTextFileFrame::OnMenuOpenSelected(wxCommandEvent& event)
{
wxTextFile file;
wxString text;
int result;
result = FileDialog1->ShowModal();
if(result==wxID_OK){
SetTitle(FileDialog1->GetPath());
file.Open(FileDialog1->GetPath());
for(size_t i=0; i<file.GetLineCount(); i++){
text << file.GetLine(i) << _T("\r\n");
}
file.Close();
TextCtrl1->SetValue(text);
}
}
And also include wx/textfile.h.
#include <wx/textfile.h>