wxWidgets: wxString::wxString(int) private within this context

I have a subclass of wxHtmlListBox called TestClass, but I get the error:

/usr/include/wx-2.8/wx/string.h:682:0 /usr/include/wx-2.8/wx/string.h:682: error: 'wxString::wxString(int)' is private MainFrame.cpp:106:0 MainFrame.cpp:106: error: within this context

MainFrame.cpp line 106 is this:

TestClass *tc = new TestClass(this, wxID_ANY, wxDefaultPosition, 
                              wxDefaultSize, NULL, wxBORDER_DEFAULT);

The files for TestClass can be found at http://cl.ly/1VSo

Any thoughts on this?

Answers


You're passing wxBORDER_DEFAULT into a const wxString reference:

TestClass(
    wxWindow* parent, // this
    wxWindowID id = wxID_ANY, // wxID_ANY
    const wxPoint& pos = wxDefaultPosition, // wxDefaultPosition
    const wxSize& size = wxDefaultSize, // wxDefaultSize
    long style = 0, // NULL
    const wxString& name = wxHtmlListBoxNameStr ); // wxBORDER_DEFAULT

...but wxBORDER_DEFAULT is part of an enum (essentially an integer):

enum wxBorder
{
    /*  this is different from wxBORDER_NONE as by default the controls do have */
    /*  border */
    wxBORDER_DEFAULT = 0,

    wxBORDER_NONE   = 0x00200000,
    wxBORDER_STATIC = 0x01000000,
    wxBORDER_SIMPLE = 0x02000000,
    wxBORDER_RAISED = 0x04000000,
    wxBORDER_SUNKEN = 0x08000000,
    wxBORDER_DOUBLE = 0x10000000, /* deprecated */
    wxBORDER_THEME =  0x10000000,

    /*  a mask to extract border style from the combination of flags */
    wxBORDER_MASK   = 0x1f200000
};

So it's using the constructor you mentioned for a wxString:

wxString::wxString(int)

...which is private and hence you're getting an error. Try passing in a string or NULL instead :-)


Your line 106 does not match the constructor for TestClass, especially the last parameter / argument:

TestClass(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, const wxString& name = wxHtmlListBoxNameStr);

The TestClass wants a string, not a border style.


Need Your Help

How to pass multiple parameters in a query string openlaszlo

java openlaszlo

How can i pass multi parameters in a query string, openlaszlo? I am getting compile time error

Retrieving url from google image search for first entry, using python and selenium

python selenium

Ever since the API has been deprecated, its been very hard to retrieve the google image search url using Selenium. I've scoured stackoverflow, but most of the results to this question are from year...