Objects created in design time are not created at run time Code Blocks 13.12

Do you have a question about makefiles, a compiler or IDE you are using and need to know how to set it up for wxWidgets or why it doesn't compile but other IDE's do ? Post your questions here.
Post Reply
Ron_new
Experienced Solver
Experienced Solver
Posts: 50
Joined: Thu Mar 20, 2014 9:53 am

Objects created in design time are not created at run time Code Blocks 13.12

Post by Ron_new »

I created treeCtrl, buttons, panel etcc and other objects in the design time in Code Block 13.12 (minGw 4.7) . Doing it that way, is very convenient for me and I can arrange the layout of controls in GUI easily. But when I compile and run the project nothing is seen on the wxFrame, for some unknown reasons they are not created and not visible at run time. What can I do that to remedy that ?
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7449
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Objects created in design time are not created at run time Code Blocks 13.12

Post by ONEEYEMAN »

Hi,
What code is generated for the compilation?

Thank you.
Ron_new
Experienced Solver
Experienced Solver
Posts: 50
Joined: Thu Mar 20, 2014 9:53 am

Re: Objects created in design time are not created at run time Code Blocks 13.12

Post by Ron_new »

The code is here, it seems that codes are not been created automagically, so TC1 is my declaration/definition,

Code: Select all

Widget_TestFrame::Widget_TestFrame(wxWindow* parent,wxWindowID id)
{    //( *Initialize(Widget_TestFrame)
    wxMenuItem* MenuItem2;
    wxMenuItem* MenuItem1;
    wxMenu* Menu1;
    wxMenuBar* MenuBar1;
    wxMenu* Menu2;
    wxTreeCtrl* TC1;

    Create(parent, id, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE, _T("id"));
    SetClientSize(wxSize(842,624));
    Button1 = new wxButton(this, ID_BUTTON1, _("Label"), wxPoint(56,48), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON1"));
    Button2 = new wxButton(this, ID_BUTTON2, _("Label"), wxPoint(184,48), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON2"));
    MenuBar1 = new wxMenuBar();
    Menu1 = new wxMenu();
    MenuItem1 = new wxMenuItem(Menu1, idMenuQuit, _("Quit\tAlt-F4"), _("Quit the application"), wxITEM_NORMAL);
    Menu1->Append(MenuItem1);
    MenuBar1->Append(Menu1, _("&File"));
    Menu2 = new wxMenu();
    MenuItem2 = new wxMenuItem(Menu2, idMenuAbout, _("About\tF1"), _("Show info about this application"), wxITEM_NORMAL);
    Menu2->Append(MenuItem2);
    MenuBar1->Append(Menu2, _("Help"));
    SetMenuBar(MenuBar1);
    StatusBar1 = new wxStatusBar(this, ID_STATUSBAR1, 0, _T("ID_STATUSBAR1"));
    int __wxStatusBarWidths_1[1] = { -1 };
    int __wxStatusBarStyles_1[1] = { wxSB_NORMAL };
    StatusBar1->SetFieldsCount(1,__wxStatusBarWidths_1);
    StatusBar1->SetStatusStyles(1,__wxStatusBarStyles_1);
    SetStatusBar(StatusBar1);

    TC1  = new wxTreeCtrl(this);//, ID_TREECTRL1, wxPoint(3,25), wxSize(200,385), 0 , wxDefaultValidator, _T("ID_TREECTRL1") );

    Connect(idMenuQuit,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&Widget_TestFrame::OnQuit);
    Connect(idMenuAbout,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&Widget_TestFrame::OnAbout);
    Connect(ID_BUTTON1,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&Widget_TestFrame::OnButton1Click);
    Connect(ID_BUTTON2,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&Widget_TestFrame::OnButton2Click);
    //Connect( wxEVT_MOVE,(wxObjectEventFunction)&wid_testFrame::OnMouseMove);

    ToolBar1 = new wxToolBar(this, ID_TOOLBAR1, wxDefaultPosition, wxDefaultSize, wxTB_HORIZONTAL|wxNO_BORDER, _T("ID_TOOLBAR1"));
    ToolBarItem1 = ToolBar1->AddTool(ID_TOOLBARITEM1, _("New item"),
        wxArtProvider::GetBitmap(wxART_MAKE_ART_ID_FROM_STR(_T("wxART_NEW")),wxART_TOOLBAR), wxNullBitmap, wxITEM_NORMAL, wxEmptyString, wxEmptyString);
    ToolBarItem2 = ToolBar1->AddTool(ID_TOOLBARITEM2, _("New item"),
    wxArtProvider::GetBitmap(wxART_MAKE_ART_ID_FROM_STR(_T("wxART_NEW")),wxART_TOOLBAR), wxNullBitmap, wxITEM_NORMAL, wxEmptyString, wxEmptyString);

    ToolBar1->Realize();
    SetToolBar(ToolBar1);
......

Ron_new
Experienced Solver
Experienced Solver
Posts: 50
Joined: Thu Mar 20, 2014 9:53 am

Re: Objects created in design time are not created at run time Code Blocks 13.12

Post by Ron_new »

Any suggestion on this ?
Manolo
Can't get richer than this
Can't get richer than this
Posts: 827
Joined: Mon Apr 30, 2012 11:07 pm

Re: Objects created in design time are not created at run time Code Blocks 13.12

Post by Manolo »

Using the "automagic" wxSmith in CodeBlocks is risky when you don't know how to use wx controls by hand.

In your case I see two issues:
a) The wxTreeCtrl is empty, no root, no items.
b) I don't see sizers but absolute positions for two buttons. The wxTreeCtrl may be hidden behind other control.

My advise is first learn how to set and use controls following the provided samples. A then, when you become confortable, use wxSmith as a rapid GUI design.
Post Reply