Page 1 of 1

[SOLVED] How can i safely add my own code to the one generated by wxSmith?

Posted: Fri Jun 07, 2019 6:01 pm
by IanPo
Hello!
I recently started coding a wxWidgets app with Code::BLocks and wxSmith.

The problem is:
any change to wxSmith rewrites the constructor, which code i try to change (inserting my function call).
Is there a way to keep my changes to the code?

Re: How can i safely add my own code to the one generated by wxSmith?

Posted: Fri Jun 07, 2019 6:56 pm
by ONEEYEMAN
Hi,
You could try to derive your own class from the one generated for you...

Thank you.

Re: How can i safely add my own code to the one generated by wxSmith?

Posted: Fri Jun 07, 2019 7:24 pm
by doublemax
I don't use wxSmith, but when i look at the source it generates, i would guess you can add your own code outside the code parts that are enclosed by these comments:

Code: Select all

    //(*Initialize(testFrame)
    wxMenuItem* MenuItem2;
    wxMenuItem* MenuItem1;
    wxMenu* Menu1;
    wxMenuBar* MenuBar1;
    wxMenu* Menu2;
    
    // parts omitted
   //*)
   
   Try addding your own code here.

Re: How can i safely add my own code to the one generated by wxSmith?

Posted: Wed Jun 12, 2019 6:53 pm
by IanPo
doublemax, thanks!

I added FillStrings1(); in the end, it remains.

Code: Select all

    Connect(ID_TEXTCTRL3,wxEVT_COMMAND_TEXT_ENTER,(wxObjectEventFunction)&wxtestFrame::OnDigLenEnter);
    Connect(ID_TEXTCTRL4,wxEVT_COMMAND_TEXT_ENTER,(wxObjectEventFunction)&wxtestFrame::OnPreTrigLenEnter);
    Connect(idMenuQuit,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&wxtestFrame::OnQuit);
    Connect(idMenuAbout,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&wxtestFrame::OnAbout);
    //*)
    FillStrings1();
}