How to disable wxWebview border style ? 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
User avatar
saifcoder
Experienced Solver
Experienced Solver
Posts: 80
Joined: Thu Nov 16, 2017 9:32 pm

How to disable wxWebview border style ?

Post by saifcoder »

Hello,

Please, I would like to disable wxWebview border style, I don't mean HTML content, but the control itself.

Code: Select all

webView = wxWebView::New(panel, wxID_ANY, sURL, wxPoint(1,1), wxSize(100, 100), wxBORDER_NONE);
Error:

Code: Select all

.../include/wx/string.h:303:3: error: 'wxString::wxString(int)' is private
Platform: WX 3.1U / Win7-64 / Mingw-TDM32
P.S: Webview example compile and run fine.
Thank you,
Attachments
wxwebview_border.png
wxwebview_border.png (16.25 KiB) Viewed 1974 times
Last edited by saifcoder on Sun Nov 10, 2019 10:55 pm, edited 2 times in total.
Debian 9 - GCC 6 - wxWidgets 3.x U
Win 10 - GCC 8 - wxWidgets 3.x U
Mac OS X 10.x - Clang - wxWidgets 3.x U
i am in love with WX. Yes.
User avatar
doublemax
Moderator
Moderator
Posts: 19117
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: How to disable wxWebview border style ?

Post by doublemax »

Code: Select all

wxBORDER_NONE, 0,
Remove the 0.
virtual bool wxWebView::Create ( wxWindow * parent,
wxWindowID id,
const wxString & url = wxWebViewDefaultURLStr,
const wxPoint & pos = wxDefaultPosition,
const wxSize & size = wxDefaultSize,
long style = 0,
const wxString & name = wxWebViewNameStr
)
Use the source, Luke!
User avatar
saifcoder
Experienced Solver
Experienced Solver
Posts: 80
Joined: Thu Nov 16, 2017 9:32 pm

Re: How to disable wxWebview border style ?

Post by saifcoder »

Thank you for your reply, the 0 its was just test found here https://codelabo.com/596/ sorry for that, however it's still not working, this is more details :

Code: Select all

#include <wx/wx.h>
#include <wx/webview.h>
...
webView = wxWebView::New(panel, wxID_ANY, sURL, wxPoint(1,1), wxSize(100, 100), wxBORDER_NONE);
In file included from D:/.../include/wx/memory.h:15:0,
from D:/.../include/wx/object.h:19,
from D:/.../include/wx/wx.h:15,
from TEST.cpp:4:
D:/.../include/wx/string.h: In constructor 'myfram::myfram()':
D:/.../include/wx/string.h:303:3: error: 'wxString::wxString(int)' is private
wxString(int);
^
TEST.cpp:76:103: error: within this context
webView = wxWebView::New(panel, wxID_ANY, sURL, wxPoint(1,1), wxSize(100, 100), wxBORDER_NONE);
P.S: it's work fine without wxBORDER_NONE, or by wxWebViewBackendDefault, but border shown.
Debian 9 - GCC 6 - wxWidgets 3.x U
Win 10 - GCC 8 - wxWidgets 3.x U
Mac OS X 10.x - Clang - wxWidgets 3.x U
i am in love with WX. Yes.
alys666
Super wx Problem Solver
Super wx Problem Solver
Posts: 329
Joined: Tue Oct 18, 2016 2:31 pm

Re: How to disable wxWebview border style ?

Post by alys666 »

not working, or compiled with errors?
in file included from D:/.../include/wx/memory.h:15:0,
from D:/.../include/wx/object.h:19,
from D:/.../include/wx/wx.h:15,
from TEST.cpp:4:
D:/.../include/wx/string.h: In constructor 'myfram::myfram()':
D:/.../include/wx/string.h:303:3: error: 'wxString::wxString(int)' is private
wxString(int);
^
TEST.cpp:76:103: error: within this context
webView = wxWebView::New(panel, wxID_ANY, sURL, wxPoint(1,1), wxSize(100, 100), wxBORDER_NONE);
the error marked bold says that you are trying to create wxString from integer.
somewhere you put int as wxString parameter.
what is sURL here and how is it declared?
ubuntu 20.04, wxWidgets 3.2.1
User avatar
saifcoder
Experienced Solver
Experienced Solver
Posts: 80
Joined: Thu Nov 16, 2017 9:32 pm

Re: How to disable wxWebview border style ?

Post by saifcoder »

I don't think sURL is the problem, because it's an wxString variable, and I can replace it by direct string "http://..", however wxBORDER_NONE is the only option making the problem.

The build done only when removing wxBORDER_NONE.

maybe this is bug?
Debian 9 - GCC 6 - wxWidgets 3.x U
Win 10 - GCC 8 - wxWidgets 3.x U
Mac OS X 10.x - Clang - wxWidgets 3.x U
i am in love with WX. Yes.
User avatar
saifcoder
Experienced Solver
Experienced Solver
Posts: 80
Joined: Thu Nov 16, 2017 9:32 pm

Re: How to disable wxWebview border style ?

Post by saifcoder »

I just tested the official wxWebview sample and it's shown the same error, that mean maybe wxBORDER_NONE it's not supported at all by wxWebview!

Code: Select all

//m_browser = wxWebView::New(this, wxID_ANY, url);
    m_browser = wxWebView::New(this, wxID_ANY, url, wxPoint(1,1), wxSize(100, 100), wxBORDER_NONE);
Any one know how to remove wxWebview border please ?
Debian 9 - GCC 6 - wxWidgets 3.x U
Win 10 - GCC 8 - wxWidgets 3.x U
Mac OS X 10.x - Clang - wxWidgets 3.x U
i am in love with WX. Yes.
alys666
Super wx Problem Solver
Super wx Problem Solver
Posts: 329
Joined: Tue Oct 18, 2016 2:31 pm

Re: How to disable wxWebview border style ?

Post by alys666 »

look at documentaion.
function New prototype is

Code: Select all

New (
	wxWindow *parent, 
	wxWindowID id, 
	const wxString &url=wxWebViewDefaultURLStr, 
	const wxPoint &pos=wxDefaultPosition, 
	const wxSize &size=wxDefaultSize, 
	const wxString &backend=wxWebViewBackendDefault, 
	long style=0, ...
you missed

Code: Select all

const wxString &backend=wxWebViewBackendDefault, 
and compiler looks at your "style" paremeter, as const wxString.
add missed parameter before "style" - add wxWebViewBackendDefault before wxBORDER_NONE
ubuntu 20.04, wxWidgets 3.2.1
User avatar
saifcoder
Experienced Solver
Experienced Solver
Posts: 80
Joined: Thu Nov 16, 2017 9:32 pm

Re: How to disable wxWebview border style ?

Post by saifcoder »

I read the exact documentation section thousand times today, but I never noticed that I miss a parameter! #-o
Thank you so much for your help [-o<
Debian 9 - GCC 6 - wxWidgets 3.x U
Win 10 - GCC 8 - wxWidgets 3.x U
Mac OS X 10.x - Clang - wxWidgets 3.x U
i am in love with WX. Yes.
alys666
Super wx Problem Solver
Super wx Problem Solver
Posts: 329
Joined: Tue Oct 18, 2016 2:31 pm

Re: How to disable wxWebview border style ?

Post by alys666 »

first hint was - compiler shows you an error in function call.
this means that something is wrong in this line.
TEST.cpp:76:103:
compiler gives you a cursor position of your error line- 103.
just put cursor at this position and look what is it?
diagnostics - hidden or non existent constructor of wxString from number, says that compiler expects wxString, but there is a number.
here you must open docs or header, where this function declared, and check why compiler expects things, not expected by you. and usually it is wrong order or missed parameters you have given.
ubuntu 20.04, wxWidgets 3.2.1
User avatar
saifcoder
Experienced Solver
Experienced Solver
Posts: 80
Joined: Thu Nov 16, 2017 9:32 pm

Re: How to disable wxWebview border style ?

Post by saifcoder »

Yes exactly you are right, the problem yesterday is I look at this page https://docs.wxwidgets.org/3.0/classwx_web_view.html
Create (
wxWindow *parent,
wxWindowID id,
const wxString &url=wxWebViewDefaultURLStr,
const wxPoint &pos=wxDefaultPosition,
const wxSize &size=wxDefaultSize,
long style=0,
const wxString &name=wxWebViewNameStr)
By mistake I searched for Create() instead of New(), and it's missing the const wxString &backend=wxWebViewBackendDefault parameter!

By the way, please what is the difference between Create() and New() ?

Thank you,
Debian 9 - GCC 6 - wxWidgets 3.x U
Win 10 - GCC 8 - wxWidgets 3.x U
Mac OS X 10.x - Clang - wxWidgets 3.x U
i am in love with WX. Yes.
alys666
Super wx Problem Solver
Super wx Problem Solver
Posts: 329
Joined: Tue Oct 18, 2016 2:31 pm

Re: How to disable wxWebview border style ?

Post by alys666 »

"Create" in wxWIdgets is kinda postponed constructor, they call it - 2 stage creation, when you can allocate and somehow pre-initialize instance at first stage, but initialize completely later.
Create is a method of object, you call create for existing instance: instance->Create(...)

New - it's concept of "object factory" when programmer cannot create objects explicitly by new/statically/on stack, but must get it from "factory". Factory hides logic of allocation/creation/destruction of objects.
New creates an object, and semantically looks like "new" operator.
https://en.wikipedia.org/wiki/Factory_( ... ogramming)
ubuntu 20.04, wxWidgets 3.2.1
User avatar
saifcoder
Experienced Solver
Experienced Solver
Posts: 80
Joined: Thu Nov 16, 2017 9:32 pm

Re: How to disable wxWebview border style ?

Post by saifcoder »

got it, thank you so much for this clarification, I appreciate that.
Debian 9 - GCC 6 - wxWidgets 3.x U
Win 10 - GCC 8 - wxWidgets 3.x U
Mac OS X 10.x - Clang - wxWidgets 3.x U
i am in love with WX. Yes.
Post Reply