"wxWebView" Layout collapses Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
nasubi
In need of some credit
In need of some credit
Posts: 2
Joined: Fri Sep 22, 2017 5:50 pm

"wxWebView" Layout collapses

Post by nasubi » Fri Sep 22, 2017 6:19 pm

I am using "WebView Class" to create a simple program.
Since PC is Window 10, IE 11 is probably used.
wxwidgets version is 3.1.0.

The layout may collapse with my program.
However, when I try to display the same site with IE, it is displayed normally.

Is this a specification?
Or am I misunderstanding how to use it?
Please show the way to solve it.

Thank you.
SnapCrab_NoName_2017-9-23_3-8-28_No-00.jpg

Code: Select all

//Main.h
#ifndef MAIN_H
#define MAIN_H

#include <wx/wx.h>
#include <wx/image.h>
#include <wx/intl.h>
#include "wx/webview.h"
#include "wx/webviewarchivehandler.h"
#include "wx/webviewfshandler.h"

#ifndef APP_CATALOG
#define APP_CATALOG "app"  // replace with the appropriate catalog name
#endif

class MyFrame1: public wxFrame {
public:
    MyFrame1(wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos=wxDefaultPosition, const wxSize& size=wxDefaultSize, long style=wxDEFAULT_FRAME_STYLE);

private:
    void set_properties();
    void do_layout();

protected:
    wxWebView* window_2;
};
#endif 

Code: Select all

//Main.cpp
#include "Main.h"

MyFrame1::MyFrame1(wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style):
    wxFrame(parent, id, title, pos, size, style)
{
    window_2 = wxWebView::New(this, wxID_ANY, "https://stripe.com/", wxDefaultPosition, wxDefaultSize, wxWebViewBackendDefault, 0, "");

    set_properties();
    do_layout();
}

void MyFrame1::set_properties()
{
    SetTitle(_("frame_2"));
    window_2->SetMinSize(wxSize(500,500));
}


void MyFrame1::do_layout()
{
    wxFlexGridSizer* sizer_1 = new wxFlexGridSizer(1, 1, 0, 0);
    sizer_1->Add(window_2, 1, wxEXPAND, 0);
    SetSizer(sizer_1);
    sizer_1->Fit(this);
    sizer_1->AddGrowableRow(0);
    sizer_1->AddGrowableCol(0);
    Layout();
}

class MyApp: public wxApp {
public:
    bool OnInit();
protected:
    wxLocale m_locale;  // locale we'll be using
};

IMPLEMENT_APP(MyApp)

bool MyApp::OnInit()
{
    m_locale.Init();
#ifdef APP_LOCALE_DIR
    m_locale.AddCatalogLookupPathPrefix(wxT(APP_LOCALE_DIR));
#endif
    m_locale.AddCatalog(wxT(APP_CATALOG));

    wxInitAllImageHandlers();
    MyFrame1* frame_2 = new MyFrame1(NULL, wxID_ANY, wxEmptyString);
    SetTopWindow(frame_2);
    frame_2->Show();
    return true;
}

User avatar
doublemax
Moderator
Moderator
Posts: 14895
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: "wxWebView" Layout collapses

Post by doublemax » Fri Sep 22, 2017 8:54 pm

Since PC is Window 10, IE 11 is probably used.
Unless you tell your system otherwise, IE7 will be used. Please load https://www.whatismybrowser.com with wxWebView inside your application and check.

If it says IE7, the following post will tell you how to switch to IE11:
viewtopic.php?p=170081#p170081
Use the source, Luke!

nasubi
In need of some credit
In need of some credit
Posts: 2
Joined: Fri Sep 22, 2017 5:50 pm

Re: "wxWebView" Layout collapses

Post by nasubi » Sat Sep 23, 2017 3:08 am

Thank you !

solved.

It was very helpful.

Post Reply