Menu

#1070 wxSmith generate wrong Parent for Controls under wxToolBar

Undefined
open
nobody
wxSmith (61)
Bug_Report
2021-03-03
2021-03-03
reda uhu
No

Getting this error:

../../src/common/tbarbase.cpp(230): assert "control->GetParent() == this" failed in InsertControl(): control must have toolbar as parent

The problem is that wxSmith adds the wxTextCtrl with "This" instead of "ToolBar1"

Generated by wxSmith:

TextCtrl1 = new wxTextCtrl(this, ID_TEXTCTRL1, _("Text"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL1"));
ToolBar1->AddControl(TextCtrl1);

It should be:

TextCtrl1 = new wxTextCtrl(ToolBar1, ID_TEXTCTRL1, _("Text"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL1"));
ToolBar1->AddControl(TextCtrl1);

Discussion

  • Teodor Petrov

    Teodor Petrov - 2021-03-03
    • labels: wxToolBar, AddControl --> wxSmith
     
  • Teodor Petrov

    Teodor Petrov - 2021-03-03
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -6,13 +6,14 @@
    
     Generated by wxSmith:
    
    +~~~
     TextCtrl1 = new wxTextCtrl(this, ID_TEXTCTRL1, _("Text"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL1"));
     ToolBar1->AddControl(TextCtrl1);
    -
    +~~~
    
     It should be:
    -
    +~~~
     TextCtrl1 = new wxTextCtrl(ToolBar1, ID_TEXTCTRL1, _("Text"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL1"));
     ToolBar1->AddControl(TextCtrl1);
    +~~~
    
    -
    
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.