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

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
IanPo
In need of some credit
In need of some credit
Posts: 2
Joined: Fri Jun 07, 2019 5:49 pm

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

Post 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?
Last edited by IanPo on Wed Jun 12, 2019 6:53 pm, edited 1 time in total.
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7459
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

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

Post by ONEEYEMAN »

Hi,
You could try to derive your own class from the one generated for you...

Thank you.
User avatar
doublemax
Moderator
Moderator
Posts: 19116
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

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

Post 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.
Use the source, Luke!
IanPo
In need of some credit
In need of some credit
Posts: 2
Joined: Fri Jun 07, 2019 5:49 pm

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

Post 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();
}
Post Reply