I am developing on Ubuntu Linux using wxWidgets and I'm having a problem displaying an html file on the file system within a wxFrame. The wxFrame pops up but there is no HTML content in the window.
Here is a snippet of my OnInit() function:
//wxIMPLEMENT_APP(MyApp);
IMPLEMENT_APP_NO_MAIN(MyApp);
IMPLEMENT_WX_THEME_SUPPORT;
bool MyApp::OnInit()
{
MyFrame *frame = new MyFrame();
wxInitAllImageHandlers();
wxFileSystem::AddHandler( new wxMemoryFSHandler );
wxFileSystem::AddHandler( new wxInternetFSHandler );
HtmlWindow * htmlWindow = new HtmlWindow(frame);
htmlWindow->SetRelatedFrame(frame, "HTML");
htmlWindow->SetRelatedStatusBar(0);
wxString htmlFile = wxString("[FULL_PATH]/file.htm");
wxFileName htmlFileName(htmlFile);
htmlWindow->LoadFile(htmlFileName));
frame->Show(true);
return true;
}
As an experiment I replaced LoadFile with SetPage and saw content in the wxFrame:
htmlWindow->SetPage("<html><body>"
"<h1>TEST</h1>"
"Set Page Works"
"</body></hmtl>");
When I put file.htm in a browser I see the display fine. For some reason it doesn't want to display within the wxFrame. Please let me know if I'm missing anything. All help is much appreciated.
If someone could post a very simple stripped down wxApp, wxFrame, and wxWindow code that simply displays a local htm file that would be great. I've been struggling for so long it is getting frustrating.